#help-development

1 messages Ā· Page 1893 of 1

manic crater
#

erm, kind of tempted to just have 1 gui then ig....... or something...

#

Cuz for some reason im over thinking this..

sterile token
#

Once i finish my menu api do you want to use it?? So you dont fuck yourselft

lost matrix
manic crater
#

?paste

undone axleBOT
analog prairie
#

Will it cause an error if I don't check if the item is covered before removing the item?

analog prairie
#

Google translate

#

🄲

ivory sleet
#

But let’s break the word down,
Application (the interface’s goal is to provide an easy to talk set of interactions in regards to the application, can be only parts or the entire application)
Programming (related to that we use the interface in programming, so not a keyboard or the interface in the car)
Interface (something that offer what you can done, but not how it’s done)

lost matrix
patent horizon
analog prairie
#

If I don't check if there is an item before removing the item, will it cause an error

sterile token
patent horizon
#

what

kind hatch
ivory sleet
#

That’s the gist of it

manic crater
ivory sleet
#

aaa long as you can denote that the api is for an application and the fact that it’s involved in some sort of programming then ye

patent horizon
ivory sleet
#

Let’s not be rude when it comes to inexperience (:

sterile token
patent horizon
#

material

lost matrix
sterile token
patent horizon
#

idk

sterile token
#

Oh

manic crater
sterile token
patent horizon
#

no

#

intellij

sterile token
#

I looks really similar

#

Aaa allright

kind hatch
ivory sleet
lost matrix
manic crater
unreal quartz
#

Ooh

#

Bit of drama in here?

manic crater
#

no

unreal quartz
#

Hmmm

ivory sleet
#

Seems to be somewhat controversial

kind hatch
#

Possibly

manic crater
#

Look no drama is "coming along in here"

patent horizon
#

conclure understands that literally the number one most thing annoying to beginner coders is "learn basic <language>". just because it isnt confusing to you doesnt mean it is to them and gatekeeping the support channel isnt needed

lost matrix
kind hatch
manic crater
manic crater
patent horizon
#

so it seems like you're no better than the people you despise - ?

kind hatch
#

lmao

manic crater
ivory sleet
#

I mean I do believe the learn java card can be played sometimes, but then you really need to tell the learner what exactly they should learn, as there are a lot of things in Java.

sterile token
#

Lmao nice discussion

lost matrix
manic crater
sterile token
lost matrix
patent horizon
manic crater
#

Gotta love this error.

ivory sleet
tired dagger
#

Any ideas why it can't find the config.yml?

manic crater
#

Caused by: java.lang.IllegalStateException: Initial initialization <- Dumbest error to exist.

ivory sleet
#

How do you build Trent

kind hatch
tired dagger
ivory sleet
#

^ and make sure you don’t just build with artifacts

kind hatch
#
<resources>
  <resource>
    <directory>src/main/resources</directory>
    <filtering>true</filtering>
  </resource>
</resources>
lost matrix
patent horizon
#

does order matter?

#

i did

lost matrix
#

wait

#

mavenCentral()

ivory sleet
#

good

lost matrix
#

I was forced...

sterile token
#

What a lovely thing about spigot development

#

Testing plugins without getting out Intellij

paper viper
#

there is a gradle plugin that does that for you

#

you just run a gradle task

sterile token
paper viper
#

and it does it for you

patent horizon
#

i switched to gradle because shading in maven is too weird for my head

sterile token
#

GRADLE?

sterile token
paper viper
#

Lol

ivory sleet
unreal quartz
sterile token
#

Wait its easy to develop/code a custom repo manager for Gradle?

patent horizon
#

well shading + relocating

ancient plank
#

adelemThonk is maven shading weird

young knoll
#

I still need to get remapping worked out with gradle

sterile token
lost matrix
unreal quartz
analog prairie
#

Can I ask questionsšŸ™

sterile token
#

I dont know why people never post about how to develop/code a custom repo manager for Maven/Gradle

sterile token
undone axleBOT
#

If you have a question, please just ask it. Don't look for staff or topic experts. Don't ask to ask or ask if people are awake or available. Just ask the question to the channel straight out, and wait patiently for a reply. Make sure you use the right channel regarding the topic of your question. Create a thread in case the channel is already in use!

lost matrix
young knoll
sterile token
unreal quartz
analog prairie
#

I think i will got the answer that I need to learn Java😢

sterile token
undone axleBOT
lost matrix
kind hatch
kind hatch
kind hatch
patent horizon
#

is there an easier way of getting a server playercount, or would i just do Bukkit.getOnlinePlayers().size()

sterile token
lost matrix
tired dagger
sterile token
kind hatch
#

Oh, didn't see that.

analog prairie
#

I would like to know how to check if the player has the item and how much

lost matrix
unreal quartz
kind hatch
tired dagger
#

oky

sterile token
unreal quartz
#

What 7smile7 said but I would use reposilite instead as it is much lighter

sterile token
#

But this year i will start learning about data strucutures so i think that will help me

#

I cannot expect much im 15 old

unreal quartz
#

Well your data structures class will teach you what a linked list is etc. Not really applicable here]

kind hatch
sterile token
unreal quartz
#

Yes

sterile token
#

I think you missunderstand the message

tired dagger
#

Oddly enough it was detecting the config.yml earlier and then it just stopped

unreal quartz
kind hatch
# analog prairie Thanks

Also, ItemStack has a constructor that can take amounts. ItemStack(Material.MATERIAL, amount) You can use that to check for the amount of items.

lost matrix
unreal quartz
#

We do a little graph theory

kind hatch
tired dagger
hardy swan
#

Learning data structures can help you, well, decide which data structures to use...

unreal quartz
#

Or reverse a linked list

#

Because everybody needs to know how to do that

hardy swan
#

Why does a linkedlist need reversal

kind hatch
hardy swan
#

It is a deque

unreal quartz
#

Okay then

#

Reverse a singularly-linked* non-circular* linked list

lost matrix
sterile token
#

People

kind hatch
sterile token
#

InventoryClickEvent#setCalled its not working no matter if i put it on MenuListenr class or the in the consumer InventoryClickEvent

#

I wanna cryy

sterile token
tired dagger
#

*not

hardy swan
#

Reverse a queue

#

Java linkedlist goes brrr

unreal quartz
#

Well a queue can be implemented with a linked list

tired dagger
#

Let me delete the file and re-open the project maybe its buggin

hardy swan
#

Yes, but if it is implemented as a linked list, then it is a deque too :D

unreal quartz
#

If it is a doubly linked list

hardy swan
#

Im referring to java linkedlist

unreal quartz
#

And I wasn't lol

tired dagger
hardy swan
#

Ah ok

sterile token
kind hatch
sterile token
tired dagger
#

Oh great, windows has to update. gimme a min.

sterile token
#

hahaha

kind hatch
#

NOOOOOOO, DON'T DO IT.

#

We lost one today. 😢

sterile token
kind hatch
#

Another soul lost to the windows update.

sterile token
#

He?

#

I dont understand you

kind hatch
#

Who knows when they will return.

sterile token
#

I dont understand you ref

kind hatch
#

The joke being windows update sucks and he could potentially be stuck for hours.

#

Or it could upgrade him to windows 11

#

And then he will really be fucked.

ancient plank
#

windows updates are so fast for me

patent horizon
#
    @EventHandler
    private void onDamage(EntityDamageEvent event) {
        Player player = (Player) event.getEntity();
        if (player.getGameMode() == GameMode.ADVENTURE) event.setCancelled(true);
    }``` is there a better way to do this?
sterile token
kind hatch
ancient plank
#

my PC is $900

sterile token
kind hatch
sterile token
#

My pc its more than 1200 dollars cuz i put in it 64gb

#

If not it will be cheaper

patent horizon
#

^

#

i didnt know if there was one specific to players

young knoll
#

No

hardy swan
#

Then check clause before casting

kind hatch
#

There was, but it then got changed to the EntityDamageByEntityEvent

patent horizon
#

you mean like the instanceof thing

ancient plank
#

check if the entity is an instance of player

hardy swan
#

Guard clause

sterile token
hardy swan
#

Yea

patent horizon
#

alr

ancient plank
kind hatch
#

I'm not one of them, but still.

#

SSDs are god tier.

sterile token
#

Could you obfuscate System.loadLibrary() forJNI loading?

lost matrix
sterile token
#

or its too difficult?

patent horizon
#
    @EventHandler
    private void onDamage(EntityDamageEvent event) {
        if (event.getEntity() instanceof Player player) {
            if (player.getGameMode() == GameMode.ADVENTURE) event.setCancelled(true);
        }
    }``` i came up with this
#

good?

young knoll
#

Might as well combine the Ifs

patent horizon
#

ah k

hardy swan
#

I wont recommend deep nesting in code

#

You can do guard clause if your java version is still less than 14

tired dagger
#

well

hardy swan
#

if (!(entity instanceof Player)) return

young knoll
#

It bothers me that you need extra () to use ! with instanceof

tired dagger
#

Looks like Intellij was just buggin. It works now

#

ĀÆ_(惄)_/ĀÆ

lost matrix
hardy swan
#

Lol

hardy swan
kind hatch
#
@EventHandler
    private void onDamage(EntityDamageEvent event) {
        if (!(event.getEntity() instanceof Player)) return;
        if (player.getGameMode() == GameMode.ADVENTURE) event.setCancelled(true);
    }

I just think this looks cleaner.

ancient plank
#

java16+ superiority

patent horizon
#

ah everyone cramming their code preferences down my spine

#

alralr guys thx

young knoll
#

Why can’t java let us do !instanceof

ancient plank
#

coding discords be like

kind hatch
#

fr

young knoll
#

instanceofnt

sterile token
#

I dont tolerate code without { } when single lines, multi lines of code when its only one line, doing loops without lamda

lost matrix
sterile token
#

I have seen something really strange. A whole plugin write with classes, packages, methods, fields all in Spanish come ON

patent horizon
#

how would i players in adventure mode appear as if they're in spectator (like where their skin is 50% opacity)? packets?

lost matrix
ancient plank
#

time to fork adoptium

kind hatch
young knoll
#

Time to harass John Java

#

The god emperor of java

kind hatch
#

Mr Java himself

sterile token
young knoll
#

I’m aware

#

But that’s gross

sterile token
lost matrix
young knoll
#

0/10 worst language

tired dagger
hardy swan
#

Java is indeed a bad language

tired dagger
#

Every class inherits from the Object class

kind hatch
hardy swan
#

Cuz it is easy

sterile token
lost matrix
hardy swan
#

in comparison

#

To other languages

unreal quartz
#

Because it is used in giant codebases and engineers are too lazy to migrate a whole codebase to a different language and would rather just patch the existing one

hardy swan
#

Or other paradigm

unreal quartz
#

It's not popular because it is 'good'

sterile token
#

I would all life prefer Java and C# instead of yeat like Js, Php, Ts, C++, etc sintaxis code 0 understable

tired dagger
#

Maybe its just because I haven't looked at Python in ages but its simplistic syntax seems more confusing to me than Java

unreal quartz
#

It's popular because people are stuck with it since everyone thought it was the next best thing in the early 2000s

ancient plank
#

syntax

young knoll
#

Sin Tax

#

Pay up

ancient plank
#

cosine taxes

sterile token
#

I have say it many times

lost matrix
# hardy swan To other languages

Java is one of the hardest languages to get a grasp of.
Python, C, JavaScript and Rust are for example all way simpler to learn

young knoll
#

Y’all are spigot devs you’ve committed plenty of sins to be taxed for

hardy swan
#

And java only supports oop

sterile token
hardy swan
#

By default

ancient plank
#

python isn't easy for me because I'm used to bracket-based languages and tabs are Kappa

kind hatch
lost matrix
unreal quartz
young knoll
#

Python is cursed

ancient plank
#

nah because visual studio got mad at me because the code I pasted from stack overflow used spaces while I use tabs

young knoll
#

Especially when you start using numpy

ancient plank
#

and I spent so long fixing it

sterile token
ancient plank
#

and c# breaks my head because it looks like Java but it has 🤮 naming conventions

#

I like c++ tho

hardy swan
#

C++ is such a great language

sterile token
#

Really yeat sintax

hardy swan
#

Disregard what linus have to say

sterile token
#

let say the method are strange, etc

lost matrix
unreal quartz
hardy swan
#

it is fast, easy to use (in comparison to C)

#

it supports classes, unlike C

waxen plinth
#

rust

kind hatch
#

You do know that java was created to be a competitor to c++ right? That's why they are similar.

unreal quartz
#

Making a lot of comparisons to C here

hardy swan
#

and it has procedural, unlike java

#

and it is fast, unlike java

ancient plank
#

I like

 cout << "Please input a number between 1 and 1000" << endl;
 cin >> guess;

the syntax highlighting in discord for cpp

lost matrix
waxen plinth
ancient plank
#

I am also captivated by the << and >> in cout and cin

#

idk

kind hatch
#

That's the part I hate.

hardy swan
young knoll
#

OwO<<

hardy swan
#

java still slow

#

XD

kind hatch
#

Not by much.

waxen plinth
#

Not really

paper viper
#

?

#

lol

kind hatch
#

Java can get pretty damn close to native C++ performance if you know what you are doing.

paper viper
#

nothing wrong with the language you use

#

people use python too

waxen plinth
#

Python, now that's a slow language

sterile token
unreal quartz
patent horizon
#

im not sure which packet will achieve this effect

lost matrix
young knoll
#

That’s why I keep my computer on the stovetop to help the jvm warm up faster

hardy swan
#

not only that, java has this thing that initiates fields to 0 or null by default

worldly quest
#

how would i wait for a certain amount of time then set a boolean, ive tried the scheduler and just wait() but idk

kind hatch
unreal quartz
paper viper
#

and web scratching

hardy swan
#

most that i know use c++

paper viper
#

so its not really performance

#

but its a good example

kind hatch
#

It still uses python though

paper viper
#

of how it is a good info retrieval tool

young knoll
#

This just in: computers are fast

sterile token
#

Omg my MenuAPI its saying that my menu its null

lost matrix
tired dagger
#

Well, it turns out none of my code works because If I remove the key from the config.yml (in plugins folder) the plugin just uses the default values from the embedded config.ymlšŸ™ƒ

sterile token
sterile token
kind hatch
tired dagger
#

So custom config it is then?

sterile token
kind hatch
#

Yea, but they are really easy.

#
File configFile = new File("path/to/file")
FileConfiguration config = YamlConfiguration.loadConfiguration(configFile);

Then just use the instance of config for your checks.

tired dagger
#

I guess it helps to prevent users from breaking config.ymls but it takes away the customizability bc it forces the default values 😦

sterile token
#
public class FileHandler extends YamlConfiguration {

    protected final Utilities main = Utilities.getInstance(); // Your plugin instance
    protected final String name;
    protected final Boolean parent;
    protected File file;

    public FileHandler(String name, Boolean parent) throws IOException, InvalidConfigurationException {
        this.parent = parent;
        this.name = name;
        this.file = new File(this.main.getPlugin().getDataFolder(), this.name);
        if (!this.file.exists() && this.parent) { this.createParent(this.name, this.file); }
        if (!this.file.exists() && !this.parent) { this.createFile(this.file); }
        load(this.file);
    }

    public void reload() throws IOException, InvalidConfigurationException {
        this.file = new File(this.main.getPlugin().getDataFolder(), this.name);
        if (!this.file.exists() && this.parent) { this.createParent(this.name, this.file); }
        if (!this.file.exists() && !this.parent) { this.createFile(this.file); }
        load(this.file);
    }

    public void save() throws IOException {
        save(this.file);
    }

    protected void createParent(String name, File file) throws IOException {
        this.file.getParentFile().mkdir();
        if (this.main.getPlugin().getResource(name) != null) {
            this.main.getPlugin().saveResource(name, false);
        }
        this.createFile(file);
    }

    protected void createFile(File file) throws IOException {
        file.createNewFile();
    }
}
ancient plank
#

?paste

undone axleBOT
ancient plank
#

use pastes for large code blocks

sterile token
sterile token
tired dagger
#

I actually made a really simple custom config. I'll show you guys when I get back. Going to get dinner

ancient plank
#

it is quite large :)

kind hatch
sterile token
#

And then for getting/setting, etc use config#set()/config#get, etc

#

The boolean parent (false) its used when you want to load file that doesnt exists on your resource folder

kind hatch
sterile token
kind hatch
#

Ah

loud haven
#

you can also just have it ignore the default values for config keys... contains(String path, boolean ignoreDefault)

sterile token
golden turret
#

help pls

tired dagger
sterile token
#

A question can a Hashmap/Map get clear cuz using Singleton?

#

Because im debbuging my code because my menus map its empty. And i think its caused by the singleton

paper viper
#

wait for one thing why is ur main class named Utilities

#

is that your plugin name lol

sterile token
#

And it doesnt extend javaPlugin

paper viper
#

thats way too generic

#

you should choose a different name lol

sterile token
#

IDK what name, because it has many things in it

sterile token
ancient plank
#

do what every developer does

#

they take a bit of their name and add smth like lib

#

VeraLib

young knoll
#

Or do what Adele does and turn to Latin

ancient plank
#

I only do that with plugins

#

and its a mix of different languages

young knoll
#

It does work

sterile token
#

I will put it: SpigotLib

young knoll
#

I see a project on my GitHub feed called Hershboka and I have to click on it to see what it’s about

ancient plank
#

lol

sterile token
#

The name should be descriptive

ancient plank
#

technically my plugin names are descriptive

young knoll
#

Yeah Adele smh my head

ancient plank
#

just in another language

sterile token
#

I was saying to Col

buoyant viper
#

@ancient plank better than me

#

i usually pick some random word

#

hope, ivy, calamity, guardian, mocha

#

configurator

ancient plank
young knoll
#

Calamity sounds like a terrifying plugin

buoyant viper
#

:)

#

calamity, wreak havoc.

#

some (2) of my projects also get witty one-liners

young knoll
#

Be gay, do crime?

buoyant viper
#

guardian rips off GameSense's get good, get gamesense

get good, get guardian

#

except its not a cheat and not for the same game

hardy swan
sterile token
#

I have a find bug with InventoryClickEvent

#

Where i can report it?

hardy swan
#

spigot's jira issue tracker

sterile token
#

Because im doing a custom gui and it detect click event on player menu when im saying only detect it on custom menu

#

Not on player menu

#

Btww

hardy swan
#

player menu?

sterile token
#

But when i click on player menu it detect as im clicking on custom menu

hardy swan
#

and what do you mean by player menu?

sterile token
#

Its so strange

sterile token
#

Like when you open a gui you have the default inventory from minecraft

summer scroll
#

If I mount an entity using PacketPlayOutMount, does the server recognize that I'm mounting the entity or as the passenger of the entity?

sterile token
#

why?

#

I only want to block the event when you clicking on custom menu (the one on the top)

young knoll
#

Then check if the clicked inventory is equal to the top inventory

hardy swan
#

then you have to check for its inventory holder or however you implemented the gui

#

it isn't a bug

sterile token
#

its not a bug? Ouh i thought it was a bug

sterile token
#

Ahh alright

#

With event#getView() equals Inventory right?

hardy swan
#

what does it return?

sterile token
#

So i think its that one

hardy swan
#

yes

sterile token
#

oh ok

#

Thanks

#

I will try and come again if it doesnt work

#

Hahaha

hardy swan
#

try to debug it yourself first

#

many jump into asking others without spending the effort to debug the problem

sterile token
#

I wont ask for help before testing it

sterile token
wet breach
#

or as it is common called, to walk through it

sterile token
wet breach
#

debug code is whatever you want it to be

#

whether it be outputting the data some object has to the console, to names etc

young knoll
#

I call it the lazy method :p

sterile token
#

That debug you make ref?

wet breach
sterile token
#

Does ready has an option for sending/receibing Json Obejcts without parsing them to json string?

gleaming grove
#

Use GSON instead of Json Object

sterile token
#

Gson parses Json code

#

Or im wrong

gleaming grove
#

GSON is api for Json, so you save a lot of time

#

By Json code you mean the Json content?

sterile token
#

Nothing forget, i just remeber slots counts from 0

gleaming grove
#

So yea GSON is very easy to use and when you need to do more complex stuff you have pretty good GSON configuration

sterile token
#

It only supports string

young knoll
#

Json can easily be converted to and from a normal string

gleaming grove
#

The point of Json is to covert class to string and in the other way

sterile token
#

I need a simple way of sending custom class object via ready

#

That what i need

#

Redis*

gleaming grove
#

Sending where?

#

You just read data from Json onpluginEnable and save to Json in onpluginDisable

sterile token
#

I was talking about Redis

#

I think i writed ready instead of redis

gleaming grove
#

Read about Repository desing patern it could be useful in your case

sterile token
#

But repository in what way?

#

Related to Objects right?

gleaming grove
#

Its a class to get/insert/delete/update objects

#

Between database and your Application

sterile token
#

Why database?

gleaming grove
#

Redis is database right?

sterile token
#

I will create a system with Packets, let say you create TestPacket with some parameters. Then i need a way for sending/receiving that Packet object from/to Redis

gleaming grove
#

And the Issue is to read packet from string to its class?

sterile token
#

Yeah

gleaming grove
#

Mediator desing Pattern is good for this purpose

sterile token
gleaming grove
#

Or just create method Public <T>T convert(String key, Class<T> classDestination)

sterile token
#

But its great that method

gleaming grove
#

You need to figure out implementation for that method it was example

sterile token
#

Yeah but its great up to kno

#

I will keept it

sacred mountain
#

can anyone here make me a really simple plugin that hooks onto placeholder api? i literally just want the plugin to return a value set in the config when %vlands% is sent (with placeholdeapi)

#

my tried have failed

#

also, whats the equivalent of world.getBlock() for 1.8?

#

world.getBlockState(event.pos).getBlock();

this?

sterile token
sterile token
sacred mountain
sterile token
sacred mountain
#

i want to make a placeholder plugin that returns a value that is set in the config

undone axleBOT
sacred mountain
#

i dont have any

sterile token
#

Ahh

#

So first you will have to create a new class

sacred mountain
#

im on a phone

sterile token
#

Ahh allright

#

I sent request, told me when you are and when i see it it will help you

#

Oh nice finally i think my Menus api its working

sterile token
#

When you have a value on a map and you add the same value, its overwrited or not?

woeful moon
#

I'm trying to make a system where players can claim a reward every 12 hours. I was thinking of using a cache like this:

private Cache<UUID, Long> cooldown = CacheBuilder.newBuilder().expireAfterWrite(12, TimeUnit.HOURS).build();

to add players to the cache when they claim the reward, then have it automatically removed after 12 hours. is that a good idea or is there a better way to do it?

sterile token
#

I dont recommend like that, zuz what happen if server go off?

sterile token
woeful moon
#

wdym

woeful moon
sterile token
#

Wait have you understnd?

woeful moon
#

I understand the problem, but what do you suggest I do instead?

sterile token
#

Like that cache its temporal. So if server goes down the cache will get cleaned

woeful moon
#

yes I understand

sterile token
#

So should use something for saving that

#

Like a database or Flatfile storage

woeful moon
#

I see

sterile token
#

But i think that can work

#

I use that Cache system + MongoDB

pine island
#

any other way to compare arg name ? also how do i check if player is op

woeful moon
sterile token
woeful moon
#

^^

sterile token
woeful moon
#

šŸ‘ thanks

pine island
#

making a sw plugin and a op can choose a kit by doin somth like /kit <arg = insane">

woeful moon
#

@pine island player.isOp() for the op check I believe

pine island
#

sw = skywars*

sterile token
#

I know

#

Do you understand how args works?

pine island
#

yeah

sterile token
#

First of all, args = an array

#

So its start from 0

pine island
#

yep i know that

sterile token
#

Ok

pine island
sterile token
#

Yeah

#

Wait send full command

pine island
#

1 sec

sterile token
#

?paste

undone axleBOT
sterile token
#

Over there please

pine island
#

ofc

sterile token
pine island
sterile token
#

thans

#

Giveme some minutes

#

I will check

#

What do you want to in resume?

pine island
#

resume?!?

sterile token
#

Like what do you want to do

#

Why do you do args.getName()

pine island
#

make it so the arg can be either "normal" "insane" "amplified" and give the loot acrdingly

#

i dont know

sterile token
#

You dont need args.getName()

pine island
#

i have no clue why i added that

sterile token
#

You should use args[index] in others words you should use args[0].equalsIgnoreCase()

pine island
#

ohkl

woeful moon
#

yeah it's just args[0] args[1] etc

pine island
#

tysm!!

sterile token
#

I recommend you learning the basics about java and spigot api

woeful moon
#

@sterile token do you know any tutorials for sqlite?

sterile token
#

BEcause you will have many problems then

sterile token
#

I had worked many times

pine island
#

i know the basics i woke up like 15mins ago

sterile token
#

Or ask here

woeful moon
#

yeah I honestly don't know where to start with sqlite

#

couldn't find any tutorials online

sterile token
#

Let start from the begin

woeful moon
#

yes, I've worked with mysql & sqlite from a server owner perspective countless times, just not from a development standpoint

sterile token
#

Allright

#

What do you want to do

#

Because SQLite its database for local storage (one plugin)

woeful moon
#

I want to make a plugin that lets players claim a reward (do a command) every 12 hours.

sterile token
#

Ah allright

woeful moon
#

no syncing or anything, very simple stuff

sterile token
#

I will make you a simple example

#

I have my api with many things and include databases for MySQL, SQLite and MongoDB

woeful moon
#

Oh sweet, thanks!

hardy swan
#

have you guys gotten the hacktoberfest shirts

iron tundra
#

Issue: Texture on stone slab is not being replaced with a dirt block texture
Stuff I have troubleshooted: I have looked over my JSON file for the models and textures, I have looked over my code, I have looked over the download and host of the resource pack
Stone slab overwrite JSON

{
  "parent": "minecraft:block/slab",
  "textures": {
    "bottom": "minecraft:block/stone",
    "top": "minecraft:block/stone",
    "side": "minecraft:block/stone"
  },
  "overrides": [
 {"predicate": {"custom_model_data":1234567), "model: "block/dirt_slab"}
]
}

dirt slab JSON file

{
  "parent": "minecraft:block/slab",
  "textures": {
    "bottom": "minecraft:block/dirt",
    "top": "minecraft:block/dirt",
    "side": "minecraft:block/dirt"
  }
}
sterile token
# woeful moon Oh sweet, thanks!
public class Sqlite {

  private Connection connection;

  public void connect(JavaPlugin plugin, String name) throws Exception {
    File file = new File(plugin.getDataFolder(), name);
    if (!file.exists()) { file.createNewFile(); }
    this.connection = DriverManager.getConnection("jbdc:sqlite://" + file);
    System.out.println("Connected to sqlite " + name);
  }
        
  public void disconnect() throws Exception {
    this.connection.close();
    System.out.println("Disconnected from sqlite ");
  }

  public Connection getConnection() { return connection; }
}
iron tundra
#

Would appreciate if someone can figure out why the overwrite on the texture isn't working

pine island
#

why is it not giving me import class option?

sterile token
#

First you should create an instance of that class, I recommend on Main class.

pine island
iron tundra
sterile token
#

For adding things: MainClass#SqliteInstance#getConnection()#prepareStatement()#executeUpdate() -> void
For getting things: MainClass#SqliteInstance#getConnection()#prepareStatement()#executeQuery() -> ResultSet

woeful moon
#

makes sense

#

what does the preparedStatement() do though?

sterile token
#

prepareStement("Here goes sql code")

#

A fully example would be

#
This is how you create a table
getConnection().prepareStatement("CREATE TABLE IF NOT EXISTS table (uuid, age)").executeUpdate();
gleaming grove
#

preparedStatement() prevent you from being hacked

sterile token
gleaming grove
#

it removes all sql Injection stuff

sterile token
woeful moon
#

Ok, sweet

sterile token
#

It do it easy for queries, if not you would need to put the values inside this `

#

You understand right jack?

woeful moon
#

I'm also getting an UnhandledException from

        Sqlite database = new Sqlite();
        database.connect(this, "data");

what did I do wrong?

gleaming grove
sterile token
gleaming grove
#

send full class

woeful moon
sterile token
#

An example i did for him

sterile token
#

o i right wrong

#

i didnt write jdbc

gleaming grove
#

for sure first argument should not be this

woeful moon
#
public class Sqlite {

    private Connection connection;

    public void connect(JavaPlugin plugin, String name) throws Exception {
        File file = new File(plugin.getDataFolder(), name);
        if (!file.exists()) {
            file.createNewFile();
        }
        this.connection = DriverManager.getConnection("jbdc:sqlite://" + file);
        
        System.out.println("Connected to sqlite " + name);
    }

    public void disconnect() throws Exception {
        this.connection.close();
        System.out.println("Disconnected from sqlite ");
    }

    public Connection getConnection() {
        return connection;
    }
}

this is the sqlite class

sterile token
sterile token
#

Not jbdc

#

It was my error

woeful moon
#

šŸ‘

#

still didn't fix the error though

sterile token
#

change its on getConnection() method

woeful moon
gleaming grove
#

sorry i missunderstood the purpose of that method

#

wtf

sterile token
gleaming grove
#

why you need to put plugin object inside connect

#

it does not make sense

sterile token
#

For the db file

#

It wont be created on the heaven

woeful moon
#

the whole method?

sterile token
gleaming grove
#

and the disconnect and getConnection method can thrown exception

sterile token
#

Yeah

#

If you dont know how try-catch google its your best friend

quaint mantle
sterile token
sterile token
#

šŸ¤”

#

I sent wrong emoji

#

have you seen?

woeful moon
#
public class Sqlite {

    private Connection connection;

    public void connect(JavaPlugin plugin, String name) throws Exception {
        try {
            File file = new File(plugin.getDataFolder(), name);
            if (!file.exists()) {
                file.createNewFile();
            }
            this.connection = DriverManager.getConnection("jdbc:sqlite://" + file);

            System.out.println("Connected to sqlite " + name);
        } catch (Exception e) {
            System.out.println("Error with sqlite");
        }
        
    }

    public void disconnect() throws Exception {
        try {
            this.connection.close();
            System.out.println("Disconnected from sqlite ");
        } catch (Exception e) {
            System.out.println("Error disconnecting from sqlite");
        }
    }

    public Connection getConnection() {
        try {
            return connection;
        } catch (Exception e) {
            return null;
        }

    }
}

hmm, like this?

sterile token
# woeful moon the whole method?

Declare the variable "Sqlite sqlite" out of your onEnable() method. And then on enable just do: sqlite = new Sqlite(this,, "dbname")

quaint mantle
#

I mean, the connection object should not persist. Or idk, do you send connecting/disconnecting message every transaction?

sterile token
#

Manya dont critice my code

#

I do it as example model

#

When the connection object persist?

woeful moon
gleaming grove
#

so what>

sterile token
woeful moon
sterile token
#

Idk why he critices my code

quaint mantle
woeful moon
sterile token
woeful moon
#

wdym?

sterile token
#

Just put sqlite = new Sqlite()

quaint mantle
#

HikariCP is fast enough that you can obtain a Connection, execute SQL, and then return it back to the pool many times in the course of a request.

It is a Best Practice to only hold Connections in local variables, preferably in a try-with-resources block, or possibly passed on the stack, but never in a class member field. If you follow that pattern it is virtually impossible to leak a Connection or accidentally share across threads.

sterile token
#

What dont you understand

gleaming grove
#
        try
        {
            sql.connect(this,"Name");
        }
        catch (Exception e)
        {
            e.printStackTrace();
        }```
rancid snow
#

does hikaricp come with spigot?

gleaming grove
#

try this code

sterile token
rancid snow
#

is it using over the default library?

sterile token
rancid snow
#

default sql library with spigot

sterile token
#

Spigot doesnt have any default sql library with it

quaint mantle
quaint mantle
rancid snow
pine island
#

why cant i create a plugin for 1.8?

sterile token
sterile token
woeful moon
sterile token
pine island
quaint mantle
woeful moon
#

1.8 is like 7 years old ;-;

quaint mantle
kind hatch
rancid snow
#

^^ I'm 100% sure java.sql comes with latest spigot

#

ohh

pine island
kind hatch
#

java.sql Meaning it comes from java itself.

sterile token
rancid snow
#

but if I use a real db I should use hikaricp?

kind hatch
#

Yes

quaint mantle
#

If global networks do something thst doesnt means its good

pine island
#

pvp is better on 1.8

sterile token
woeful moon
#

agree to disagree šŸ™‚

quaint mantle
#

No

river oracle
#

most servers I've interacted with are using either 1.8 or 1.12.2 a minority I've encountered are actually dealing with 1.16+

rancid snow
#

^^^

sterile token
#

SO for discussions go to #general please

pine island
#

alright is there a way to make a 1.8 plugin in intelli j?

sterile token
river oracle
#

^

quaint mantle
gleaming grove
#

yes, generate plugin for 1.18 and adjust maven file to support 1.8

pine island
#

nope i use maven 1.8 still dosnt show up

quaint mantle
sterile token
quaint mantle
#

Dont play a moderator

sterile token
#

I recommend 1.8.8 R3

pine island
#

why not 1.8.9 lol

sterile token
#

I use 1.8.8 and no problems

river oracle
#

1.8.8 is the last 1.8 server version that I know of

quaint mantle
#

It is client side only version

woeful moon
#

please don't use 1.8 😐 it's literally just outdated software, full of exploits, and unsupported

kind hatch
woeful moon
#

you can use a plugin to achieve that

quaint mantle
sterile token
#

For dicussions go #general

kind hatch
#

^

sterile token
#

Here as said Shadow its for development help

quaint mantle
#

Extremely primitive abd monotonous pvp bound to the mouse clicking capability

lavish hemlock
#

^^^

sterile token
#

I wotn dicuss anymore

#

For building Spigot version (you want), you should use Spigot Build Tools

sterile token
pine island
#

yep

#

found it

sterile token
#

Allright

#

You have created a Maven Project or Java Project?

pine island
#

just a simple command then i can import it to my IntelliJ folder

sterile token
#

If your project its maven you should add it as dependency like this:

<dependency>
  <groupId>org.spigotmc</groupId>
  <artifactId>jar-name</artifactId>
  <version>your-version</version>
  <systemPath>your jar route</systemPath>
</dependency>
pine island
#

weird

sterile token
#

Are you in the same dir?

pine island
#

i dont think so...

sterile token
#

Linux or windows?

pine island
#

win

#

using git bash

sterile token
#

He?

river oracle
sterile token
#

If windows do cd C:/Usuarios/YouUser/Desktop

pine island
#

alr

sterile token
pine island
#

i have bash installed

#

as in linux sub system

sterile token
#

I dont understand you

lavish hemlock
#

WSL

sterile token
#

Ahh

#

HE run the same as me

#

I run a system that its a comination of linux and windows

kind hatch
#

Chads just run Linux.

sterile token
#

Just open a cmd and run:

cd C:/Usuarios/YouSystemUser/Desktop

pine island
#

cd .\Desktop

#

this is always better

sterile token
#

I think

#

You should move to desktop route if you have the BuildTools.jar there

#

In other words the jar, should be in the same route as you

woeful moon
#

@sterile token trying around with the code a bit more, did you find it somewhere or come up w/ it yourself?

woeful moon
#

did you follow a tutorial I can check out?

sterile token
pine island
#

i forgot to download the build tools .jar

kind hatch
#

Look. Wherever you have the jar file is the directory you need to run the command in. Usually when you download something it’ll be in your downloads folder. I’d suggest moving that to a new folder and running it in there as the jar will create directories and files that might be hard to find if you are in a crowded directory.

sterile token
#

For queries, you just need to know SQL

woeful moon
#

Ok

sterile token
#

Like search on google how to create a table with SQL, the same for adding values, etc

#

You should take in mind that SQLite its a relational database, and the data its store on tables with key-value system

#

Thanks for correction

hardy swan
#

Haha

sterile token
#

I forget that

#

Cuz i finally decided to use mongo

hardy swan
#

I can only understand relational

hardy swan
sterile token
#

With mongo you can save/get/update/etc directly an Object (document)

#

That what i understand

hardy swan
#

Wow, I havent met with a situation where I need that lol

#

Cuz there is always jackson for json files

#

In terms of java

sterile token
#

That what i dont like about SQL db, that they are relational

#

And when you need a value related with other table we dont talk anymore. HaHaHa

hardy swan
#

I mean

quaint mantle
#

relational databases has advantages as well

hardy swan
#

There are joins

sterile token
#

Yes but the problem start when i dont understand how the relations works

#

I now basic sql queries

#

Not advanced with joins, relations, etc

hardy swan
#

Ah i think after i learnt joins, I cant think of a problem that cant be solved with rdbms hahaha

quaint mantle
#

Foreign keys are cool

hardy swan
#

And yeah that

sterile token
#

A question

#

How do you get player view on InventoryOpenEvent?

#

With getViews() right?

pine island
#

i think so

hardy swan
#

Is it a getViewers

sterile token
#

It gives all views i think a Set<> or array

hardy swan
#

All viewers yes

sterile token
#

Aa ok

#

Thanks

#

Cuz i have 64gb of ram but with Intellij i cannot open google

pine island
#

dang

#

i have 8

sterile token
#

Lumina

#

Could you save your problem

hardy swan
#

Firefox

sterile token
# pine island dang

I forgot telling you that for check if player is op just do: player#isOP()

pine island
#

yep i know that

sterile token
hardy swan
#

JavaFx webview

pine island
#

or u could do if (player.isOp() == true)

#

i use opera too

sterile token
# hardy swan Firefox

Why you dont have option getView() on InvOpenEvent and on InvClickEvent, invCloseEvent you have it

sterile token
sterile token
hardy swan
#

Inherited from InventoryEvent

pine island
hardy swan
#

return player.isOp();

#

?

sterile token
#

No

#

Im explaning him

#

That its not necessary to == true, because player.isOP() will return true/false

sterile token
pine island
#

well yeah but its just a few more characters dosnt really matter

sterile token
#

Idk why+

sterile token
pine island
#

this 1.8 build is taking so long ;-;

hardy swan
#

I see #getView in spigot api documentation tho

#

It is part of InventoryEvent

runic quiver
#

guys how to add essentials api, its always error on me Cannot resolve org.bstats:bstats-bukkit:1.8

pine island
#

hmm

#

do u want economy api?

runic quiver
#

._.

pine island
#

might wanna ask this

#

in ESSX discord

sterile token
runic quiver
pine island
sterile token
runic quiver
pine island
#

imma dm u

runic quiver
pine island
#

there is no invite to it

#

what

runic quiver
#

oh nvm i found it

#

xD

pine island
#

its called MOSS for some reason

sterile token
#

Cuz im having an inssue when opening menu B from menu A

#

In menu A i cannot take the items, but on menu B yes

pine island
#

alright it finished

#

what to do now?

sterile token
pine island
#

yeah that finished up

sterile token
#

Right

#

Maven project or Java Proejct?

pine island
#

maven

sterile token
#

allright go to pom.xml

pine island
#

for 1.16

sterile token
#

In pom.xml go to you dependencies section

#

Add this dependency

<dependency>
  <groupId>org.spigotmc</groupId>
  <artifactId>jar-name</artifactId>
  <version>your-version</version>
  <systemPath>jar-route</systemPath>
</dependency>
sterile token
#

Yeah

#

And it doesnt matter because you have it locally

#

Let say, if its on repo you should know the version

#

And then just reload the pom

pine island
#

wait i cant find the jar which one?

sterile token
#

Wait what?

#

the last part?

#

In my case i have a folder on desktop called Dev there i have spigots, etc.

pine island
#

it created this

sterile token
#

Oh

#

I will tag someone

sterile token
#

Ahh i think you have to compile the jar

pine island
#

cant i create a project in eclipse and move the folder to my intelliJ projects folder

sterile token
pine island
#

yep it does

hardy swan
sterile token
#

Not me

#

Hahaha

hardy swan
#

Oh lol

pine island
#

ill try creating a eclipse project 1 sec

hardy swan
#

I know what will definitely work

sterile token
hardy swan
#

Oh yea, buildtools

#

Why

#

No he doesnt have to compile manually

sterile token
#

Explain him

hardy swan
#

But running the buildtools should automatically install the relevant jars to your local maven repository

sterile token
#

I love multi module projects. Hahaha i have installed my multi module project more than 20 in less than an 1 hour

sterile token
hardy swan
#

Yep

sterile token
#

That the location right?

hardy swan
#

@pine island are you using any build systems for your project

hardy swan
#

Great then just include in pom.xml the dependency will do

sterile token
#

That its what i use for using depencies that are not installed on my local repo

sterile token
#

So he just need to add it as normal depency

hardy swan
#

Yep

sterile token
#

Allright

pine island
#

no jar here and in the folder

sterile token
#

join that folder

#

.m2/repositories

pine island
#

there

sterile token
#

now go to folder

#

org/spigot

hardy swan
#

.m2/repository/org/spigotmc/spigot-api/1.8.8-R0.1-SNAPSHOT/

#

Or watever version you intend to use

sterile token
#

Yeah

#

I think he choose 1.8.8

pine island
#

there

sterile token
#

anyone else debug like this?

#

Directly from intellij console

hardy swan
#

Yes

#

There is a wiki post on spigotmc about that

#

But i dont use intellij

sterile token
#

What use?

#

Dont tell me eclipse

hardy swan
#

Vscode

sterile token
#

Oh lol

hardy swan
#

What no one use for java

sterile token
#

I hate

#

Yeah like its not so normal

#

I thin kyou use the Vscode IDE

#

Because there are 2 verions

hardy swan
#

I used it for web dev

#

vscode isnt an ide

#

Technically

sterile token
#

There is a version that its an ide If not how you will compile projects etc

#

Or that what i ithink

hardy swan
#

Compile via commands

#

mvn clean install

sterile token
#

Hum

spiral light
#

Uff

sterile token
pine island
#

In this episode of the Spigot MC Plugin series, I show you how to create a plugin on most versions of Minecraft, even those not supported by the IntelliJ MC Dev Plugin. #Spigot #SpigotTutorial

Join the Community! - https://discord.gg/cortexdev

⭐ Kite is a free AI-powered coding assistant that will help you code faster and smarter. The Kite plu...

ā–¶ Play video
spiral light
pine island
#

1.8.8 java plugin in intelliJ