#help-development

1 messages · Page 1594 of 1

opal juniper
#

wait i may be wrong

serene agate
#

how would i go about making a balance for the player?

#

ive made a balance hashmap

#

but how should i store the keys?

quaint mantle
#

UUID, Double

opal juniper
#

^

serene agate
#

should i create a key when players join?

quaint mantle
#

i would use persistentdatacontainers

#

so its persistent and reliable

opal juniper
#

^ either use pdc or store it in a yaml or db

quaint mantle
#

i reccommend the first way more than the latter

opal juniper
#

yuhuh

#

same

serene agate
#

ah ok

quaint mantle
#

?pdc

serene agate
#

but how/when should i make keys for the persistentdatacontainer?

quaint mantle
#

if it doesnt exist when they join

serene agate
#

is it fine if i make one each time a new player joins

opal juniper
serene agate
#

ok

#

wow so if u make a persistent data container it basically auto saves?

opal juniper
#

mhm

serene agate
#

no need to do fancy saving magic on it

#

neat

opal juniper
#

they are very cool

serene agate
#

indeed

limber mica
#

anyone know how to fix this com.zaxxer.hikari.pool.HikariPool$PoolInitializationException: Failed to initialize pool: Cannot load connection class because of underlying exception: 'java.lang.NumberFormatException: For input string: "3306:3306"'.

opal juniper
#

What do you mean 3,0 & 6 are all numbers thonk

left gale
#

hey, has anyone worked with the jda in bungeecord?

ivory sleet
#

ye

ivory sleet
opal juniper
#

Yeah… it was a joke…

ivory sleet
#

I guess you were jokin

#

ye

left gale
#

how can I register a class with a ListenerAdapter in OnEnable?

ivory sleet
#

from jda?

left gale
#

ye

ivory sleet
#

create a new JDA instance using the JDABuilder

#

like you'd do everywhere else

left gale
#

ah, okay

#

thx

limber mica
#

Caused by: java.sql.SQLException: Unknown initial character set index '255' received from server. Initial client character set can be forced via the 'characterEncoding' property.

reef wind
#

the racist was finally banned!

daring sierra
#

the racist? i'm pretty sure that was a random pfp for another alt

reef wind
#

nope

#

he was racist

#

multiple times

#

staff didn't do shit tho

#

even tho I told them

quaint mantle
#

discord mods at their finest

reef wind
#

yep

opal juniper
#

This

reef wind
#

yeah, quite sad.

#

doing nothing about racism

#

and all other isms too

#

bruh

#

he deleted it

opal juniper
#

Oh he is here

#

Hello 👋

#

Or - an admin

quaint mantle
#

probably md5 lurking

reef wind
#

they don't want shit

opal juniper
#

Nah bet it was imagine or conclure

reef wind
#

for not doing shit about racism

ivory sleet
#

was unsure if that was nnyak

opal juniper
#

Eyyyyyyy

reef wind
#

😐

ivory sleet
#

but the reply confirms it

opal juniper
#

No it is not

#

That was a good film

reef wind
#

^

#

movie

#

but ok

opal juniper
#

Anyways, back to #general

reef wind
#

wait

#

wat

ivory sleet
#

anyways his behavior in this channel would get him banned nonetheless, red the dialogue

quaint mantle
#

🔴

sharp badge
#

How could I store temporary meta data (until server is rebooted) inside of a block when a user places it?

opal juniper
#

I mean you could map the location to the data

sharp badge
#

I just want to store the data temporarily, not long term. Was looking for a situation using meta data to store the information on the block itself

ivory sleet
#

what is temporarily?

sharp badge
#

From the time it is placed until the server is rebooted

ivory sleet
#

transient?

opal juniper
#

Cause temporarily to me means memory

ivory sleet
#

oh so weak data

sharp badge
#

Correct

limber mica
#

Ok ok

#

people

ivory sleet
#

yeah well is this any type of block?

unreal quartz
quaint mantle
opal juniper
sharp badge
#

Yeah, when the player places the block I would like to tag it

limber mica
#

INSERT INTO `kitCooldown`(`UUID`, `Name') VALUES (\"%s\", \"%s\")", player.getUniqueId().toString(), player.getName()) I got this right how come it's not actually being showed in my sql database?

sharp badge
quaint mantle
#

google

unreal quartz
#

use an actual prepared statement

opal juniper
#

True

limber mica
#

I AM

unreal quartz
#

you’re not

limber mica
#

``` PreparedStatement psa = conn.prepareStatement(String.format("INSERT INTO kitCooldown(UUID, `Name') VALUES ("%s", "%s")", player.getUniqueId().toString(), player.getName()));

opal juniper
#

Second

unreal quartz
#

that’s a format string

opal juniper
#

Shit

ivory sleet
#

well imagine metadata would only be possible for tile entities

unreal quartz
#

use the PS properly

limber mica
#

why

ivory sleet
#

oh does it?

#

ah fair then,

unreal quartz
#

remove “%s” and replace it with ?, you can replace r those placeholders with PreparedStarament#setString etc

#

don’t use a format string

#

also it seems like you’re trying to insert into 4 columns, but have only given 2

limber mica
#

no

#

why would I replace it with ?

#

If I was gonna use ? wouldn't I need String.format

round finch
#

i wish to learn how to detect player open their own inventory

#

all i think accept that is

#

runnable check

#

for opened inventory

#

so server doesn't tell if a player inventory is open right?

#

woaw that sucks

#

how would i make the "hack"

limber mica
unreal quartz
limber mica
#

so I can't use toString

#

hold up

#

What would be considered PreparedStatement

foggy bough
quaint mantle
#

?paste show code

undone axleBOT
foggy bough
#

put I don't have a null or anything in my EntityDeathEvent ```public void onDeathEntity(EntityDeathEvent e) {
if(e.getEntity().getKiller().equals(EntityType.PLAYER)) {
e.getEntity().getWorld().dropItem(e.getEntity().getLocation(), new ItemStack(rmats, im));
}
}

quaint mantle
#

whats in rmd.java line 57

foggy bough
#

this java if(e.getEntity().getKiller().equals(EntityType.PLAYER)) {

limber mica
#

did I do this correct ```java
PreparedStatement psa = conn.prepareStatement(String.format("INSERT INTO kitCooldown(UUID, `Name') VALUES ("?", "?")"));
psa.setString(1, player.getUniqueId().toString());
psa.setString(2, player.getName());

foggy bough
#

how can I check if the person that killed entity is player

#

k

#

k

novel shuttle
#

Can anyone help me, I'm trying to get a value from config.yml, but it always gives an error, what can I do?

foggy bough
#

I do know java just spigot is new to me

novel shuttle
#

rg.bukkit.command.CommandException: Unhandled exception executing command 'spawn' in plugin Tutorial v1.0
at org.bukkit.command.PluginCommand.execute(PluginCommand.java:46) ~[spigot.jar:git-Spigot-c3c767f-33d5de3]
at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:141) ~[spigot.jar:git-Spigot-c3c767f-33d5de3]
at org.bukkit.craftbukkit.v1_8_R1.CraftServer.dispatchCommand(CraftServer.java:646) ~[spigot.jar:git-Spigot-c3c767f-33d5de3]
at net.minecraft.server.v1_8_R1.PlayerConnection.handleCommand(PlayerConnection.java:1115) [spigot.jar:git-Spigot-c3c767f-33d5de3]
at net.minecraft.server.v1_8_R1.PlayerConnection.a(PlayerConnection.java:950) [spigot.jar:git-Spigot-c3c767f-33d5de3]
at net.minecraft.server.v1_8_R1.PacketPlayInChat.a(PacketPlayInChat.java:26) [spigot.jar:git-Spigot-c3c767f-33d5de3]
at net.minecraft.server.v1_8_R1.PacketPlayInChat.a(PacketPlayInChat.java:53) [spigot.jar:git-Spigot-c3c767f-33d5de3]
at net.minecraft.server.v1_8_R1.PacketHandleTask.run(SourceFile:13) [spigot.jar:git-Spigot-c3c767f-33d5de3]
at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source) [?:1.8.0_301]
at java.util.concurrent.FutureTask.run(Unknown Source) [?:1.8.0_301]
at net.minecraft.server.v1_8_R1.MinecraftServer.z(MinecraftServer.java:696) [spigot.jar:git-Spigot-c3c767f-33d5de3]
at net.minecraft.server.v1_8_R1.DedicatedServer.z(DedicatedServer.java:316) [spigot.jar:git-Spigot-c3c767f-33d5de3]
at net.minecraft.server.v1_8_R1.MinecraftServer.y(MinecraftServer.java:634) [spigot.jar:git-Spigot-c3c767f-33d5de3]
at net.minecraft.server.v1_8_R1.MinecraftServer.run(MinecraftServer.java:537) [spigot.jar:git-Spigot-c3c767f-33d5de3]

#

there's more, but I can't send

#

at java.lang.Thread.run(Unknown Source) [?:1.8.0_301]
Caused by: java.lang.IllegalArgumentException: Plugin already initialized!
at org.bukkit.plugin.java.PluginClassLoader.initialize(PluginClassLoader.java:122) ~[spigot.jar:git-Spigot-c3c767f-33d5de3]
at org.bukkit.plugin.java.JavaPlugin.<init>(JavaPlugin.java:66) ~[spigot.jar:git-Spigot-c3c767f-33d5de3]
at net.diego.tutorial.ConfigGenerator.<init>(ConfigGenerator.java:6) ~[?:?]
at net.diego.commands.spawn.SpawnCommand.onCommand(SpawnCommand.java:18) ~[?:?]
at org.bukkit.command.PluginCommand.execute(PluginCommand.java:44) ~[spigot.jar:git-Spigot-c3c767f-33d5de3]
... 14 more

#

Caused by: java.lang.IllegalStateException: Initial initialization
at org.bukkit.plugin.java.PluginClassLoader.initialize(PluginClassLoader.java:125) ~[spigot.jar:git-Spigot-c3c767f-33d5de3]
at org.bukkit.plugin.java.JavaPlugin.<init>(JavaPlugin.java:66) ~[spigot.jar:git-Spigot-c3c767f-33d5de3]
at net.diego.tutorial.Main.<init>(Main.java:13) ~[?:?]
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) ~[?:1.8.0_301]
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source) ~[?:1.8.0_301]
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source) ~[?:1.8.0_301]
at java.lang.reflect.Constructor.newInstance(Unknown Source) ~[?:1.8.0_301]
at java.lang.Class.newInstance(Unknown Source) ~[?:1.8.0_301]
at org.bukkit.plugin.java.PluginClassLoader.<init>(PluginClassLoader.java:76) ~[spigot.jar:git-Spigot-c3c767f-33d5de3]
at org.bukkit.plugin.java.JavaPluginLoader.loadPlugin(JavaPluginLoader.java:131) ~[spigot.jar:git-Spigot-c3c767f-33d5de3]
at org.bukkit.plugin.SimplePluginManager.loadPlugin(SimplePluginManager.java:329) ~[spigot.jar:git-Spigot-c3c767f-33d5de3]

#

at org.bukkit.plugin.SimplePluginManager.loadPlugins(SimplePluginManager.java:251) ~[spigot.jar:git-Spigot-c3c767f-33d5de3]
at org.bukkit.craftbukkit.v1_8_R1.CraftServer.loadPlugins(CraftServer.java:291) ~[spigot.jar:git-Spigot-c3c767f-33d5de3]
at org.bukkit.craftbukkit.v1_8_R1.CraftServer.reload(CraftServer.java:744) ~[spigot.jar:git-Spigot-c3c767f-33d5de3]
at org.bukkit.Bukkit.reload(Bukkit.java:534) ~[spigot.jar:git-Spigot-c3c767f-33d5de3]
at org.bukkit.command.defaults.ReloadCommand.execute(ReloadCommand.java:25) ~[spigot.jar:git-Spigot-c3c767f-33d5de3]
at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:141) ~[spigot.jar:git-Spigot-c3c767f-33d5de3]
at org.bukkit.craftbukkit.v1_8_R1.CraftServer.dispatchCommand(CraftServer.java:646) ~[spigot.jar:git-Spigot-c3c767f-33d5de3]
at org.bukkit.craftbukkit.v1_8_R1.CraftServer.dispatchServerCommand(CraftServer.java:632) ~[spigot.jar:git-Spigot-c3c767f-33d5de3]
at net.minecraft.server.v1_8_R1.DedicatedServer.aM(DedicatedServer.java:353) ~[spigot.jar:git-Spigot-c3c767f-33d5de3]
at net.minecraft.server.v1_8_R1.DedicatedServer.z(DedicatedServer.java:317) ~[spigot.jar:git-Spigot-c3c767f-33d5de3]
... 3 more

#

I use new to register commands

ivory sleet
#

Nms 1_8_R1 long time no see

novel shuttle
#

no

#

public class ConfigGenerator extends JavaPlugin{

public String configGetter(String value) {
    return getConfig().getString(value);
}

public void worldSetter(String value, World world) {
    getConfig().set(value, world);
}

public void coordSetter(String value, double coord) {
    getConfig().options().copyDefaults(true);
    getConfig().set(value, coord);
}

}

#

I'm starting today

quaint mantle
#

Would it be interesting to gather all inventories in a single plugin, in a single eventhandler or make each inventory in its respective plugin?

limber mica
#

[23:35:20 WARN]: java.sql.SQLException: Parameter index out of range (1 > number of parameters, which is 0).

#
PreparedStatement psa = conn.prepareStatement(String.format("INSERT INTO `kitCooldown`(`UUID`, `Name') VALUES (?, ?)"));
                    psa.setString(1, player.getUniqueId().toString());
                    psa.setString(2, player.getName());
ivory sleet
#

You still should remove String.format

#

It’s practically useless there

quaint mantle
#

In terms of performance, each plugin would be better for its inventory and eventhandler, or a plugin that works as an api, pulling inventories.

limber mica
novel shuttle
#

How can I get a value from my config.yml?

limber mica
#

LMAO monkey retard code

#

My stuff isn't being saved in the database

#

it's not even being put it in there

eternal oxide
limber mica
#

hsuh

eternal oxide
#

yes boss

quaint mantle
#

What would a delay code be?

eternal oxide
#

?scheduler

#

u

#

um

#

?schedule

#

I know its there somewhere

ivory sleet
#

?scheduling

undone axleBOT
ivory sleet
#

😋

eternal oxide
#

There it is 🙂

limber mica
#

uh > [23:42:25 WARN]: java.sql.SQLException: Parameter index out of range (1 > number of parameters, which is 0).

#
PreparedStatement psa = conn.prepareStatement("INSERT INTO `kitCooldown`(`UUID`, `Name') VALUES (?, ?)");
                    psa.setString(1, player.getUniqueId().toString());
                    psa.setString(2, player.getName());
#

I got it

lost matrix
limber mica
#

It's because I had `

#

nothing is being stored though

lost matrix
limber mica
#

I printed out psa

#

and everything was correct in it

round finch
#

1.17.1 Protocollib achivement detection on achivement open?

#

Protocollib is complete new for me

paper viper
#

wdym on achievement open

limber mica
paper viper
#

lol

#

you dont show code

paper viper
#

Ah im dumb

hasty prawn
limber mica
#

Yes

paper viper
#

but still thats not enough info

paper viper
blazing lintel
#

"Only true programmers can list all the possible causes"

hasty prawn
#

You are actually executing the statement right?

limber mica
#

yes

lost matrix
#

You got the right jdbc driver, right?

limber mica
#

um

#

I don't even have the drivers

#

If you mean this com.mysql.jdbc.Driver then yes

#

I'm using Hikari

blazing lintel
#

disclaimer, i have no idea what im talking about
||are you sure that the psa.setString starts at 1 and not 0?||

lost matrix
lost matrix
outer sorrel
#

how would i be able to get block materials with a 1.17 plugin in a 1.12 server?
I keep getting

[09:24:46 WARN]: Exception in thread "pool-5-thread-1" java.lang.NoSuchFieldError: SHULKER_BOX
[09:24:46 WARN]:        at com.justdoom.flappyanticheat.checks.movement.groundspoof.GroundSpoofA.handle(GroundSpoofA.java:85)
[09:24:46 WARN]:        at com.justdoom.flappyanticheat.packet.processor.ReceivingPacketProcessor.lambda$handle$0(ReceivingPacketProcessor.java:16)
[09:24:46 WARN]:        at java.util.ArrayList.forEach(Unknown Source)
[09:24:46 WARN]:        at com.justdoom.flappyanticheat.packet.processor.ReceivingPacketProcessor.handle(ReceivingPacketProcessor.java:16)
[09:24:46 WARN]:        at com.justdoom.flappyanticheat.listener.NetworkListener.lambda$onPacketPlayReceive$0(NetworkListener.java:18)
[09:24:46 WARN]:        at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
[09:24:46 WARN]:        at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
[09:24:46 WARN]:        at java.lang.Thread.run(Unknown Source)
outer sorrel
#

line is
if(block.getType() == Material.SHULKER_BOX){

lost matrix
blazing lintel
outer sorrel
lost matrix
limber mica
#

7smile7

#

so what's another issue

#

no errors

blazing lintel
#

how long do you wait after sending the request? maybe its timing out and u dont wait long enough for a timeout error

lost matrix
limber mica
#

well

#

start naming them

blazing lintel
limber mica
#

hm

#

I don't think so

blazing lintel
#

ok try waiting like 5 minutes

#

or if you know the default timeout time, wait that + 30 seconds

lost matrix
limber mica
#

um

novel shuttle
#

How do I have to get a value in a config.yml?

limber mica
#

well

#

I don't know what else to give you

#

MySQL returned an empty result set (i.e. zero rows). (Query took 0.0003 seconds.)

lost matrix
blazing lintel
novel shuttle
limber mica
#

I did do that

blazing lintel
blazing lintel
lost matrix
limber mica
#

so

lost matrix
#

And make sure you actually have a table with that name

lost matrix
# limber mica so

I think the table names are also case sensitive. So make sure they match up.

limber mica
#

They do

lost matrix
limber mica
#

but

#

its not even saving

lost matrix
limber mica
#

I got no clue

#

How do I check

lost matrix
#

Probably not then

#

Try logging into your db and inserting a row by hand

limber mica
#

yea it works

lost matrix
#

And pls send the whole method that contains your prepared statement

limber mica
#
Connection conn = Core.getInstance().getData().getConnection();
                    PreparedStatement psa = conn.prepareStatement("INSERT INTO kitCooldown(UUID, Name, Time, Kit) VALUES (?, ?, ?, ?)");
                    psa.setString(1, player.getUniqueId().toString());
                    psa.setString(2, player.getName());
                    psa.setInt(3, 1);
                    psa.setString(4, "p");
                    conn.close();
                    psa.close();
lost matrix
#

You dont even execute the statement. You just prepare and then close the connection.

limber mica
#

It's in a command

lost matrix
#

So?

eternal oxide
#

when you close the connection you lose the PS

lost matrix
#

You send nothing to the database. You prepare a nice statement and then you dont send it to the DB.

limber mica
#

so uh

lost matrix
#

psa.executeUpdate();

#

Before you close the connection

#

If you would have sent the whole code before you could have spared me all the guessing -.-

stone sinew
#

When you're trying to test enderman stealing blocks and non of them are even bothering to steal them 🤦

quaint mantle
#

not ground level

stone sinew
limber mica
#

Oh look at that it works

stone sinew
#

Yeah placed a few blocks and they got removed xD

quaint mantle
#

Can using a function to add hexadecimal color support often generate lag?

limber mica
#

wait if I store something in a hashmap and restart the "Server" will it still be there?

quaint mantle
#

no

limber mica
#

Ok that's what I thought

quaint mantle
#

you got to store it in a file or database

stone sinew
stone sinew
round finch
novel shuttle
#

How do I use the world variable in config.yml?

#

For example, I previously defined in config.yml the world by Location, how can I use this world in location

#

Main.plugin.getConfig().set("spawn.world", p.getLocation().getWorld().getName());

#

it was defined as world

stone sinew
round finch
#

World w = Bukkit.getWorld(String);

novel shuttle
#

thanks

round finch
#

tip
if you want to make mutiple locations in one word you could do just as exemple

Worlds . WorldName . Number or name (id) . X
Worlds . WorldName . Number or name (id). Y
Worlds . WorldName . Number or name (id). Z

lost matrix
quaint mantle
#

you're mean

lost matrix
#

Just was wondering what happened here while i was gone for a month or so ^^

ivory sleet
#

Discord helpers, uh well not much really

lost matrix
#

Btw if you dont need to parse user input then worlds should be serialized using their UUID instead of their name

round finch
#

tomorrow i will try to figure more about achievement check "hack" for inventory open
bye bye to all the great helpers here there is enjoying their time! CB_heartkeqing

lost matrix
round finch
#

got the idea from some guy who send me it
it was on spigot forum

round finch
#

sleep deprived

blazing lintel
#

i was more confused on the first sentence lol, what are you going to make?

round finch
#

PlayerOpenInventory Check

blazing lintel
#

oh to see when a player opens achievement gui?

#

oh that

#

Im pretty sure i saw it somewhere else, i will send you the link if i can find it, is it ok to ping if i find it?

round finch
#

i wish that i could copy it XD
i'm unfamiler to it

blazing lintel
#
ProtocolLibrary.getProtocolManager().addPacketListener(new PacketAdapter(YOUR_PLUGIN_HERE, PacketType.Play.Client.CLIENT_COMMAND){
            @Override
            public void onPacketReceiving(PacketEvent event){
                if(event.getPacket().getClientCommands().read(0) == EnumWrappers.ClientCommand.OPEN_INVENTORY_ACHIEVEMENT){
                    Player player = event.getPlayer();
                    //Do something                
                }
            }
        });
#

this?

round finch
#

it gonna be challenge to learn wtihout no previus knowledge

round finch
#

my version is 1.17.1

blazing lintel
#

which part doesnt work? not firing?

round finch
#

all i need is to check openned

blazing lintel
#

ok but which part does not work

#

does the code not get called

#

ie. that statement is never satisfied

#

if you are developing with hacks in mind there is more to worry about, and its not just hacks but anything that optimizes network might do this

round finch
#

it won't import

blazing lintel
#

if you have a better option send it

blazing lintel
round finch
#

and most of the code is just red in my ecplise

blazing lintel
#

if you have a better option send it

blazing lintel
#

do you use maven or gradle

#

then dont complain about them you already warned us once thats enough

round finch
#

i used external jar

blazing lintel
#

its not pointless

#

it will work

#

so literally every fucking person uses a hacked client. good to know

#

you are incorrect. literally incorrect. thats all i have to say

round finch
#

instead

#

dm me any infomation if you do!

blazing lintel
#

im 99% sure what he meant is that he was making hacky code to do it

blazing lintel
round finch
#

i have used maven before

#

but idk gradle

blazing lintel
round finch
#

my idea is to check for PlayeropenIventory place fake Item using packet to cleint

#

place a book in off hand

blazing lintel
#

ok but are you using maven?

round finch
#

like in the shield slot

round finch
#

for procotocal

blazing lintel
#

do you have a maven.xml

round finch
blazing lintel
#

do you have these lines of code in it:

#
  <repository>
    <id>dmulloy2-repo</id>
    <url>https://repo.dmulloy2.net/repository/public/</url>
  </repository>

#
  <dependency>
    <groupId>com.comphenix.protocol</groupId>
    <artifactId>ProtocolLib</artifactId>
    <version>4.6.0</version>
  </dependency>

#

@round finch

round finch
#

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <groupId>spigot</groupId>
  <artifactId>spigotmc</artifactId>
  <version>0.0.1-SNAPSHOT</version>
  
  
  
  <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.17.1-R0.1-SNAPSHOT</version>
           <scope>provided</scope>
    </dependency>
</dependencies>
</project>
blazing lintel
#

is that your whole ass maven file

#

@round finch

round finch
#

yes

blazing lintel
#

ok so add these

#

to the respective places

#

ill spoonfeed

#

if needed

#

if not needed, then reload your maven xml

#

and see if the errors persist

round finch
blazing lintel
#

ok

#
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <groupId>spigot</groupId>
  <artifactId>spigotmc</artifactId>
  <version>0.0.1-SNAPSHOT</version>
  
  
  
  <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>
 <repository>
    <id>dmulloy2-repo</id>
    <url>https://repo.dmulloy2.net/repository/public/</url>
  </repository>
</repositories>

<dependencies>
    <!--This adds the Spigot API artifact to the build -->
    <dependency>
           <groupId>org.spigotmc</groupId>
           <artifactId>spigot-api</artifactId>
           <version>1.17.1-R0.1-SNAPSHOT</version>
           <scope>provided</scope>
    </dependency>
 <dependency>
    <groupId>com.comphenix.protocol</groupId>
    <artifactId>ProtocolLib</artifactId>
    <version>4.6.0</version>
<scope>provided</scope>
  </dependency>
</dependencies>
</project>
hybrid spoke
#

spoonfeeding a pom is not spoonfeeding, its just pure laziness

blazing lintel
#

ik the indents are completely fucked, just reformat the code if u want those fixed

blazing lintel
blazing lintel
round finch
#

i clicked maven install?

#

is that right?

blazing lintel
#

well yes i think, i dont use eclipse

limber mica
#

is there something like PreparedStatement#getString

blazing lintel
#

anyways now check the protocol lib things

#

and see if the red things still exist

quaint mantle
round finch
#

no changes

blazing lintel
round finch
#

nope no errors

blazing lintel
#
You need to update the project configuration manually. Project -> Maven -> Update Configuration

Also set checkbox: Update Project Configuration from pom

this is how you should upate the config apparently

limber mica
#

Is ResultSet reliable?

round finch
#

just successfull build

ivory sleet
round finch
#

still same thing

blazing lintel
round finch
#

yes

#
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <groupId>spigot</groupId>
  <artifactId>spigotmc</artifactId>
  <version>0.0.1-SNAPSHOT</version>
  
  
  
  <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>
    
    <repository>
    <id>dmulloy2-repo</id>
    <url>https://repo.dmulloy2.net/repository/public/</url>
  </repository>
  
</repositories>

<dependencies>
    <!--This adds the Spigot API artifact to the build -->
    <dependency>
           <groupId>org.spigotmc</groupId>
           <artifactId>spigot-api</artifactId>
           <version>1.17.1-R0.1-SNAPSHOT</version>
           <scope>provided</scope>
    </dependency>
    
    <dependency>
     <groupId>com.comphenix.protocol</groupId>
     <artifactId>ProtocolLib</artifactId>
     <version>4.6.0</version>
    </dependency>
  
</dependencies>
</project>
blazing lintel
round finch
#

is it right?

blazing lintel
#

change the artifactId of protocollib from ProtocolLib to ProtocolLib-API

#

and then check again

#

@round finch ||sorry for putting so many pings im not sure if u see the messages and i dont really have patience to wait like 10 minutes ||

round finch
#

it is all okay angelpanda

blazing lintel
#

good xd

#

well if its still red after doing the above tell me

round finch
#

[ERROR] Failed to execute goal on project spigotmc: Could not resolve dependencies for project spigot:spigotmc:jar:0.0.1-SNAPSHOT: com.comphenix.protocol:ProtocolLib-API:jar:4.6.0 was not found in https://hub.spigotmc.org/nexus/content/repositories/snapshots/ during a previous attempt. This failure was cached in the local repository and resolution is not reattempted until the update interval of spigot-repo has elapsed or updates are forced -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/DependencyResolutionException

#

@blazing lintel

blazing lintel
#

h u h

#

oh

#

its cached

#

wait hold on what

#

oh

#

force updates

#

i think you can click [help 1] so maybe there is steps there to force updates

round finch
#

Failed to execute goal on project itsvollx: Could not resolve dependencies for project itsvollx:itsvollx:jar:0.0.1-SNAPSHOT: com.comphenix.protocol:ProtocolLib-API:jar:4.6.0 was not found in https://hub.spigotmc.org/nexus/content/repositories/snapshots/ during a previous attempt. This failure was cached in the local repository and resolution is not reattempted until the update interval of spigot-repo has elapsed or updates are forced -> [Help 1]

blazing lintel
#

dafug

#

well idk anything about eclipse so i cant help that much at this point

#

but do this and try again

round finch
#

added scope

#

<dependency>
<groupId>com.comphenix.protocol</groupId>
<artifactId>ProtocolLib-API</artifactId>
<version>4.6.0</version>
<scope>provided</scope>
</dependency>

unreal quartz
#

the -U switch will tell maven to force updates

#

otherwise maven won’t try to resolve the dependency again until tomorrow

limber mica
#

what sql type would I use for a Long

silk mirage
quaint mantle
#

How to prevent the player from taking the inventory item after a reload?

unreal quartz
#

don’t reload lol

quaint mantle
round finch
#

close inventory on reload?

limber mica
#

executeQuery still executes it correct?

unreal quartz
#

if it is a query yes

limber mica
#

ok

quaint mantle
#

if they interact with the inventory close it

limber mica
#

What's the max parameterIndex you can have

unreal quartz
#

as many parameters you have in your statement?

limber mica
#

hm ok

#

Is it recommended to do this ```java
if (result.getString("UUID") == null) {
conn.close();
psa.close();
return time = 0;
} else if (result.getString("Cooldown") == null) {
conn.close();
psa.close();
return time = 0;

#

like closing the connection every statement

unreal quartz
#

ideally you would use a try with resources block, your connections will be auto closed

eternal oxide
#

ok am I going absolutely crazy? new HashSet<Block>(tested) and adding to it will not affect the original Set will it?

unreal quartz
unreal quartz
eternal oxide
#

Yeah thats what I thought. I must be tired and my logic is failing somewhere 😦

limber mica
#

I got it

lucid jacinth
#

hey so ive been working on a plugin for a while and all my past versions have worked but i added like two more class files and now whenever i join the server the world refuses to render, the used ram goes wild, the server freezes, and i get timed out. im not doing anything out of the ordinary and im not running any files that have nested loops or anything of that nature. there really is no reason that itd be acting up like this. do yall think i just have a shite pc or do you think im just rarted and that theres an easy fix for this. lmk pls

#

also just for a little context bc that was quite vague, all i had in earlier versions were custom commands and joining/quitting messages, the newest version has a listener that listens for whenever a player right clicks with a certain item in hand. maybe its something to do with that?

deep mural
#

hey how do i make my newly made server public for friends to join

#

not sure if this is the right channel to ask in since no one is responding to me in #help-server

hardy swan
deep mural
#

oh thanks i guess

magic glacier
#

how do i connect a command to an array list

hardy swan
#

what to you mean by connect?

#

if you mean arguments, they are provided by the application of CommandExecutor#onCommand(command, sender, label, args) method

magic glacier
#

like i need to make a command that when i execute it, it shows a list of certain names

errant drift
#

@lucid jacinth post code otherwise nobody can help

hardy swan
lucid jacinth
# errant drift <@!407686279359365120> post code otherwise nobody can help

import bs goes here

public class PlayerInteractionListener implements Listener {
    
    private Main plugin;
    
    public PlayerInteractionListener(Main plugin) {
        this.plugin = plugin;
        Bukkit.getPluginManager().registerEvents(this, plugin);
    }
    
    @EventHandler
    public void onPlayerInteraction(PlayerInteractEvent e) {
        Player p = e.getPlayer();
        Action act = e.getAction();
        if (act.equals(Action.RIGHT_CLICK_AIR) || act.equals(Action.RIGHT_CLICK_BLOCK)) {
            Gun gun = new Gun();
            if (e.getItem().equals(gun.getGun())) {
                Snowball s = p.launchProjectile(Snowball.class);
                s.setGravity(false);
            }
        }
    }

}
#

thats whats prob causing the issue but idk why or how

limber mica
#

so I'm getting java java.sql.SQLException: Illegal operation on empty result set here java if (res.getString("UUID") == null) { return time = 0; I was doing some research and it was about using PreparedStatement#next but I don't understand why to use it instead of what I'm doing

eternal oxide
#

interesting java.lang.IllegalArgumentException: Direction's magnitude is 0!

#

direction between two blocks

lucid jacinth
# vivid lion uh show the gun class

import bs goes here

public class Gun {
    
    private ItemStack item;
    
    public Gun() {
        item = new ItemStack(Material.WOODEN_HOE);
        ItemMeta meta = item.getItemMeta();
        
        //modify all metadata
        meta.setUnbreakable(true);
        meta.setDisplayName("Gun");
    }
    
    public ItemStack getGun() {
        return item;
    }

}
hardy swan
eternal oxide
#

none

#

blocks were definately apart

#

I'll drop locations all together and work with Blocks and see if it persists

vivid lion
#

before the gun came into existance right

lucid jacinth
#

no i added Gun and the listener at the same time

#

theyre both additions in the newest version

quaint mantle
#

Hey there! spigot how can I only allow mobs to avoid players for a certain period of second?

#

pathfindergoal only can used when it spawn

waxen plinth
#

Then stop cancelling the events when you want the mobs to be able to target again

broken hare
#

Hey how can I use spring boot with spigot. This code doesn't work. I am trying to work with spring JPA to save block changes.

@SpringBootApplication
public class SpaceSaverPlugin extends JavaPlugin {
  @Override
  public void onEnable() {
    getLogger().info("Plugin Enabled");
    
    SpringApplication.run(SpaceSaverPlugin.class, "");
    
    Server server = getServer();
    
    if (server != null) {
      server.getPluginManager().registerEvents(new SpaceSaverListener(), this);
    }
  }

  @Override
  public void onDisable() {
    getLogger().info("Plugin Disabled");
  }```
#
  @EventHandler
  @Bean
  public void onBlockPlace(BlockPlaceEvent event, BlockRepository repository) {
    repository.save(new Block(event.getBlock()));
    
    for (Block block : repository.findAll()) {
      System.out.println(block.getBlock().toString());
    }
  }
#

But I get this when I run runServer

#

> Main class name has not been configured and it could not be resolved

waxen plinth
#

Oh my god

quaint mantle
#

like they scary

waxen plinth
#

Oh

#

No, not directly

#

Depending on the mob there are things you can do

#

For example, spawn an invisible cat to scare off creepers

#

Alternatively you could just push the mobs away from the player

quaint mantle
#

ah thanks you!

hexed hatch
#

You can give them the ai goals to avoid players, but have fun figuring out how to do that

quaint mantle
hexed hatch
#

You can

#

I heard Paper has a pathfinder goal api if you’re maybe using the paper api

#

I haven’t looked at it myself though

quaint mantle
#

Hello! how can I store data(String) in itemstack?

#

TMI: we can't use persistantdataconatiner in itemstack (Only in chest,echest, hopper)

summer scroll
quaint mantle
summer scroll
#

What do you need then?

quaint mantle
#

pdc occurs error

summer scroll
quaint mantle
#

or displayname

#

or encahntment

summer scroll
#

Yes you can do that

#

Just modify the pdc

#

Don't modify anything else

quaint mantle
#

oh uh

#

sorry but I don't understand what are you saying. how to modify pdc?

summer scroll
#

Get the item meta and then get the pdc

#

ItemMeta#getPersistentDataContainer

quaint mantle
#

OH

#

thanks you

#

does PersistantDataContainer or MetaData better on mob for optimazation?

summer scroll
#

but i can't really tell because I've never used metadata or pdc on entity.

#

but honestly it shouldn't make a big of difference

#

they're both not gonna impact performance at all

quaint mantle
#

thanks you again!

#

spigot NEW QUEST spigot how can I set last damager of entity? (for entity#getLastKiller())

summer scroll
#

getLastDamage you mean?

quaint mantle
#

yeah

#

I guess

#

but it returns player or entity

#

I meant, last attacker

summer scroll
#

is there a method for that?

quaint mantle
#

nop 😦

#

I tried to find

#

but I couldn't find

summer scroll
#

then you need to manually do that

silk mirage
#

uh

#

you can listen for

#

EntityDamageEvent

#

check if he has totem

#

if no, cancel the event

#

get a damaging entity from the player that you want to set the kill to

#

target that entity to the dying person

#

and it'll be done

#

(not ez)

#
private Object getHandle(Player player) {
        try {
            Method getHandle = this.getPlayerHandle==null?this.getPlayerHandle = player.getClass().getDeclaredMethod("getHandle", null):this.getPlayerHandle;
            // I think this is probably the simplest way to do this?
            return getHandle.invoke(player, getHandle);
        } catch (Exception e) {
            e.printStackTrace();
            return null;
        }
    }
    private void setKiller(Player player, Player killer) {
        try {
            Object playerHandle = getHandle(player);
            Object killerHandle = killer == null?null:getHandle(killer);
            Field nmsPlayer = this.getPlayerKiller==null?this.getPlayerKiller = playerHandle.getClass().getDeclaredField("killer"):this.getPlayerKiller;
            nmsPlayer.set(playerHandle, killerHandle);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

I found this, Thread from bukkit: https://bukkit.org/threads/have-to-set-a-killer.125443/

summer scroll
#

What? no

quaint mantle
#

thanks you anyway

silk mirage
summer scroll
#

Why would you need NMS for that

silk mirage
#

You can also use Player#damage

silk mirage
#

I linked it.

quaint mantle
#

I found solution with pdc thanks you

#

sushant and aglerr

summer scroll
#

uh huh, pdc is enough for that

quaint mantle
#

Anyone here familiar with hex color with bungee chatcolor api?

tacit drift
#

see how AdvancedNMotd does it

#

or any motd for bungee plg

quaint mantle
#

its not for bungee tho

#

and it works for since hex codes per string just doesn't work for multiple per string

quaint mantle
#

Who Looking For A Developer At Survival Minecraft Multiplayer Cracked or Premium DM

robust forge
#

Can you disable climbing with twisting vines etc? With datapacks or anything

visual tide
#

is there a way to get the friendly name from an EntityType?

crude charm
hybrid spoke
#

nvm

quaint mantle
#

I know, i am a noob with Developing. I am a beginning Developer. But i have a question! How can i find the path for a yaml?

rigid wyvern
#

Anyone know why this has started returning null? Entity e = Bukkit.getEntity(uuid); I use it to delete entities on server start from a list from file. I've confirmed the entities exist, and have same uuids after restart

stone sinew
rigid wyvern
#

Yeah, it's on a server start so there's no players loading chunks yet. I've had this working before, but now that I think about it, it may have been in spawn chunks when testing.

stone sinew
#

Could check on ChunkLoadEvent

rigid wyvern
#

What's a smart way to do this then? For context, my plugin creates entities that players cannot pickup, and armorstands that cannot be interacted with. It deletes these entities after x number of seconds, but I have a backup for when the server stops/crashes while the entities still exist and want to make sure they get deleted.

stone sinew
rigid wyvern
#

timers end on restart, it's only ~5 seconds

stone sinew
rigid wyvern
#

Alright, cheers. Thanks for the help 😄

stone sinew
#

np

iron condor
#
public class CopeCommand implements CommandExecutor {

    @Override
    public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
        if (sender instanceof Player) {
            Player player = (Player) sender;
            Bukkit.broadcastMessage(player.getName() + " has coped");
            return true;
        }

        // If the player (or console) uses our command correct, we can return true
        return true;
    }

}
#

I have built multiple times

#

and restarted the server

quaint mantle
#

I know, i am a noob with Developing. I am a beginning Developer. But i have a question! How can i find the path for a yaml?

iron condor
#

yet the space is missing

near crypt
#

is there a way to stop a bukkit runnable runTaskTimer?

stone sinew
iron condor
#

player.getName() + " has coped"

stone sinew
iron condor
#

theres a space between the player name and the text

#

yet it's not showing in game

iron condor
stone sinew
iron condor
#

I have to add 2?

stone sinew
rigid wyvern
#

If you recently made the change, make sure you don't have 2 jars sitting in your plugin jar or something.

iron condor
#

wdym?

stone sinew
#

Only thing I can think of is you aren't restarting your server.

rigid wyvern
#

if you didn't have the space the first time, and then went into your code and added it, make sure you have the new version running on your test server. idk how many times I've tried fixing a bug that I had already fixed just because I didnt use the right version

near crypt
#

how can i set a taskID to a Runnable?

iron condor
#

a couple of times

stone sinew
rigid wyvern
#

int id = Bukkit.getServer().getScheduler().scheduleSyncRepeatingTask(plugin, new Runnable() {

#

thats how I do it

#

if you're not doing repeating, change to whatever you're using ofc

near crypt
#

@stone sinew i think i know how i try it

iron condor
#

a couple of times

rigid wyvern
#

change the text completely to something different and see if that change shows up, if not, your newest one isn't going in right. should be a quick n easy test

#

or you can use a decompiler to look at the code of the jar you're using

iron condor
#

had to delete the old build

near crypt
#

?paste

undone axleBOT
near crypt
opal juniper
#

You should be returning true not false

#

But apart from that - all looks good

stone sinew
#

Such as checking what the name of the command is

near crypt
#

no i register the command in the main

#

i have a lost question: what does return true mean in the onCommand method? I think it means that the command is triggered right? and return false means the opposite?

#

@opal juniper @stone sinew

opal juniper
#

Return false means that it will send the command usage from teh plugin.yml

plain scroll
#

ok so how can i add something like "on consume give regen 3"

stone sinew
near crypt
#

and when do i have to use return true? @opal juniper @stone sinew

stone sinew
outer sorrel
#

I am making basically a custom permission system to suit my needs. whats a good way to store permissions that the players have?

near crypt
stone sinew
near crypt
#

oh okay so then it everytime sends the ussage even if the command was correct

tacit drift
#

can i gen number of online players on disable?

#

:))

#

or is there an event that triggers before the event is begining the "stopping" process

summer scroll
#

onDisable called before the player got kicked afaik

hybrid spoke
#

yeah, just get the size of the offline players.

#

you just shouldnt do anything delayed or async

vestal dome
#

Does anyone know how to get a player's mods on a spigot server using the Custom payloads forge sends?

stone sinew
vestal dome
#

how.

#

paid plugin bruh

stone sinew
#

Just no promises he would tell you

fluid cypress
#

for some reason, my command works all fine, but the alias doesnt

crude charm
#

?paste

undone axleBOT
crude charm
#

and send plugin.yml

vestal dome
#

I guess I'm getting somewhere.. but idk, thanks for the help tho.

fluid cypress
# crude charm and send plugin.yml
delhome:
    description: Delete an existing home.
    usage: /<command> <name>
    aliases: [removehome]
    permission: better.warps.del.home.command
#

/delhome <name> works, but /removehome <name> doesnt

crude charm
#

send error

fluid cypress
crude charm
#

no

#

?paste

undone axleBOT
fluid cypress
#

the "new" discord feature is for that

#

have you updated discord in the last 3 months?

#

you just have to click "expand"

crude charm
#

yes

#

but I dont like reading it

#

if you don't want to cooperate then

#

?cba

undone axleBOT
#

Zoi#0001 definitely regrets to for the most part inform you that unfortunately, they essentially are unable to definitely assist with definitely your enquiry, which essentially is fairly significant. Please simply really ask again later or possibly kind of ask someone else about this enquiry, demonstrating that the person that ran this command generally regrets to kind of inform you that unfortunately, they for the most part are unable to generally assist with actually your enquiry in a subtle way. Thank you very sort of much for kind of your time and the person that ran this command specifically wishes you a really good day, so the person that ran this command really regrets to actually inform you that unfortunately, they literally are unable to definitely assist with very your enquiry, or so they particularly thought.

fluid cypress
crude charm
#

send code

vestal dome
#

that wasn't difficult

fluid cypress
#
getCommand("delhome").setExecutor(new DelHomeCommand());
getCommand("delhome").setTabCompleter(new HomeCommandCompletion());

btw im using HomeCommandCompletion twice, is that a problem?

fluid cypress
#

im using it on the delhome and the home command

crude charm
#

ok

#

send code

#

for the command and completion class

fluid cypress
#

cmd

public class DelHomeCommand implements CommandExecutor {

    public static String messageNoNameDelHome;
    public static String messageHomeDeleted;

    @Override
    public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
        if (!(sender instanceof Player player)) {
            sender.sendMessage("[Better Warps] Only a real player can use this command.");
            return true;
        }

        String[] parsedArgs = BetterWarps.parseArgs(args);

        if (parsedArgs.length < 1) {
            player.sendMessage(messageNoNameDelHome);
            return true;
        }

        String name = parsedArgs[0];

        for (int i = 0 ; i < BetterWarps.homes.get(player).size(); i++) {
            if (BetterWarps.homes.get(player).get(i).rawName.equalsIgnoreCase(name.replaceAll("§.?", ""))) {
                Warp home = BetterWarps.homes.get(player).remove(i);
                Database.delHome(player, home);
                BetterWarps.initializePlayerHomesInventory(player);
                player.sendMessage(messageHomeDeleted);
                return true;
            }
        }

        player.sendMessage(BetterWarps.messageHomeDoesNotExistsChat);

        return true;
    }
}
#

completion

public class HomeCommandCompletion implements TabCompleter {

    @Override
    public List<String> onTabComplete(CommandSender sender, Command cmd, String arg, String[] args) {
        if (!(sender instanceof Player player)) return new ArrayList<>();

        if (args.length == 1) {
            return BetterWarps.homes.get(player).stream()
                    // get all home names without color
                    .map(home -> home.rawName)
                    // filter all home names that start with the command argument
                    .filter(home -> home.startsWith(args[0]))
                    // add quotes to home names with spaces
                    .map(home -> home.contains(" ") ? "\"" + home + "\"" : home)
                    // convert it back to a list
                    .collect(Collectors.toList());
        }
        else
            return new ArrayList<>();
    }
}
#

now that i think about it, i also need to use the parseArgs thing in the tab competer

crude charm
#

cz.thezak.Warps.Utils.Title.getNMSClass(String)" is null

serene agate
#

How do servers handle multiple minigames? Do they just load the desired minigame plugin n then unload all the others?

fluid cypress
crude charm
#

easy fix

crude charm
#

or all in one

#

really depends on how big they are

fluid cypress
#

like if java errors were readable

crude charm
serene agate
crude charm
serene agate
#

Ah

#

So if i wanted to play a particular minigame id have the plugin redirect me to a different server?

crude charm
#

and then on that server have a plugin for that minigame

fluid cypress
#

well, i already read it and i still dont know

#

so please tell me that easy fix

crude charm
serene agate
#

Is this what mc servers usually do?

crude charm
#

for bedwars

#

skywars

#

ect

#

yes

fluid cypress
#

ok thanks for the help, really appreciated

serene agate
#

Oh i see ty

crude charm
serene agate
#

What is the difference between Player and EntityPlayer

crude charm
serene agate
#

I thought an instance of player would be an entity tho

crude charm
serene agate
#

So wb smth like Creeper and EntityCreeper for example

crude charm
serene agate
#

Btw what exactly is a handle? I see a lot of getHandle functions being used in tutorials

#

Cant find docs for gethandle

stone sinew
serene agate
#

Ah ok

maiden briar
#

How can I change the message if somebody dies through another player? PlayerDeathEvent and EntityDamageByEntityEvent don't support this

#

Oh nvm had EntityDeathEvent and not PlayerDeathEvent

quaint mantle
#

I know, i am a noob with Developing. I am a beginning Developer. But i have a question! How can i find the path for a yaml?

quaint mantle
#

Yes

#

wait

#

can you come dm?

smoky oak
#

sure

opal juniper
#

hey @eternal oxide dont mean to bother you but did you get anywhere with teh pathfinding? if not i will have a look now

eternal oxide
#

I played with it last night. I got it workgin, but not accurate yet

#

my algorithm isn;t quite right

#

just started to look into it again today

opal juniper
#

oh cool, wdym by not accurate?

eternal oxide
#

occasionally it would not find a path when it should have

opal juniper
#

ohhh - fair enough

#

thanks for having a look 🙃

olive spindle
#

does anyone know the development language for bedrock plugins ?

opal juniper
#

is it like c or something

#

yeah - it is written in c ++ but afaik it doesn't support plugins

stone sinew
opal juniper
#

native bedrock is c++

#

but yea

stone sinew
#

Geyser is a spigot plugin the creates a bedrock bridge.
Also has its own bedrock server software.
Thats the only one I know of.

smoky oak
#

is there a simpler way of scanning for a structure than loading in that area of the world and manually programming a check for every block?

#

ie

#
for(int x = start; x <= end; x++){
  for(int y...
}
ivory sleet
#

I believe nms got some stuff to load structures

#

But arguably not worth dealing with

stone sinew
smoky oak
#

custom structures

#

maybe i should have clarified

#

sorry

#

so the answer's no?

#

i need to manually do it?

stone sinew
fluid cypress
#

how do i read a map from a config.yml file? something like this

some-map:
  entry1: value1
  entry2: value2
  entry3: value3

i stored the map doing config.set("some-map", Map.of("entry1", "value1", "entry2", "value2", ...)), but trying to read it with getMapList("some-map") gives me an error: ClassCastException: class java.util.ArrayList cannot be cast to class java.util.Map (java.util.ArrayList and java.util.Map are in module java.base of loader 'bootstrap')
what is a map list? and why there is no getMap method?

smoky oak
#

try casting (might give errors) or try getKeys("some-map",false)

opal juniper
#

you can get the keys

smoky oak
#

just iterate over them and do put(key, value)

opal juniper
#

and then loop through them adding the key and value

#

yep

eternal oxide
#

its not a MapList

#

just get

#

will return a MemorySection (if you have reloaded the config)

#

if not you will get a Map back

fluid cypress
visual tide
#

is there a way to add nbt data, eg {display:{Name:'{"text":"erere"}'},BlockEntityTag:{SpawnData:{id:"minecraft:chicken"},SpawnPotentials:[{Weight:1,Entity:{id:"minecraft:chicken"}}]}} to an ItemStack without messing with nms?

eternal oxide
#

?pdc

eternal oxide
#

not nms but persistent data yes

visual tide
serene agate
#

in python i can write a dictionary for items like this

swords = {
  "wooden sword": {
    "damage": 5
    "price": 10
  },
   "stone sword": {
    "damage": 7
    "price": 20
  }
}

how would i do smth similar in java? i know that i have to use hashmaps but how would i make a hashmap to fit this sort of format?

opal juniper
#

you could just make an object

#

So make a class for the sword

opal juniper
#

and set its name / damage / price

serene agate
#

oh yh thats a good idea

#

ty

visual tide
eternal oxide
#

what precisely are you trying to do as there may be API methods to do what you want without diving to nms

eternal oxide
#

no you showed me nbt tags

#

what is your end goal?

visual tide
#

getting an itemstack with those nbt tags

eternal oxide
#

ok you are not understanding.

#

forget about NBT and NMS>

#

What are you trying to do to the ItemStack?

visual tide
#

drop it naturally

visual tide
#

yes

eternal oxide
#

so what are you diving to NBT tags and nms for?

visual tide
#

not sure if im honest

quaint mantle
#

Hey, Im making a license system.

package me.mtaddons.Tutorial;

import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.configuration.file.YamlConfiguration;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.plugin.java.JavaPlugin;

public final class TutorialMain extends JavaPlugin implements Listener {
    FileConfiguration config = getConfig();
    
    @Override
    public void onEnable() {
        if(!new AdvancedLicense("Y7NG-T7OG-84OT-0CZK", "https://mtaddons.000webhostapp.com/verify.php", this).register()) return;
        
        
        getConfig().options().copyDefaults(true);
        saveConfig();
        
        
        //config.addDefault("YouAreAwesome", true);
        //config.options().copyDefaults(true);
        //saveConfig();
        
        //getServer().getPluginManager().registerEvents(this, this);
    }
    
    //@EventHandler
    //public void onPlayerJoin(PlayerJoinEvent event) {
        //Player player = event.getPlayer();
        
        //if (config.getBoolean("YouAreAwesome")) {
            //player.sendMessage("You are awesome!");
        //} else {
            //player.sendMessage("You are not awesome...");
        //}
    //}
    
    
    @Override
    public void onDisable() {
        
    }

}

This is what i have now
so you can see the "Y7.............." license is the license
if that is correct from the site it will enable the plugin
that is working
but now i want to make a config file with this text:

Setup:
  License: "Paste your license here"

and if you paste your license there it will check if its correct or not
how can i make that?

visual tide
# quaint mantle Hey, Im making a license system. ```js package me.mtaddons.Tutorial; import org...

Sorry for the length of this video, I wanted to be as detailed as possible. This episode I show you guys how to create a config.yml for your plugin and add functionality in your code to be able to access the data in the config file and also to be able to set the data. Stay Updated!! 👁

⭐ Kite is a free AI-powered coding assistant that will help ...

▶ Play video
quaint mantle
#

k

serene agate
# opal juniper you could just make an object
public class ItemForSale {
    private String name;
    private Material itemType;
    private long price;

    public ItemForSale(String name, Material itemType, long price) {
        this.name = name;
        this.itemType = itemType;
        this.price = price;
    }

    public String getName() {
        return name;
    }

    public Material getItemType() {
        return itemType;
    }

    public long getPrice() {
        return price;
    }
}
#

does this class look fine

dense goblet
#

you want to use an ItemStack instead if you wanna support NBT etc

serene agate
#

yh this is just some sort of item data container

dense goblet
#

so private ItemStack item, private long price

serene agate
#

which will hold price too

dense goblet
#

if you only need to store basic items its fine

serene agate
#

oh u can add attributes to existing classes?

dense goblet
#

?

#

nah it would still be your custom data structure

serene agate
#

oh nvm i misunderstood smth

dense goblet
#

depending on if you prefer default java serialization or bukkit serialization

serene agate
#

ah ok ty

round finch
#

i wish i had an easy way to check playerinventory open

ivory sleet
#

Isn’t there an event for that

austere cove
#

no because player inventory is client side

round finch
#

sadly 😔

ivory sleet
austere cove
#

If I have a stream from lets say a (non-java.util.concurrent) collection obtained through Collection#stream(), can one safely modify the source collection (add/remove) concurrently while I'm still using the stream

round finch
#

it doen't tigger on pressing e

ivory sleet
#

Oh fair

ivory sleet
#

A stream itself won’t trace back to its source

round finch
#

procotolib doesn't wanna work and achivementDoneevent doesn't work for me

austere cove
#

and what happens if the state of objects in the collection gets changed by calling setters?

ivory sleet
#

Then those will be changed in the stream also

#

By invoking Collection#stream() it simply creates a new stream holding references to the elements in the collection while losing any contact with the collection itself. It just pulls in what’s necessary.

austere cove
#

never really read into it, just wanted to make sure cheers

ivory sleet
#

Yeah have a good one

round finch
#

i would like some sort of solution for this waitwhat

heavy void
#

Someone knows why my JsonObject dont has a method called "has" and "getString"?

heavy void
#

import org.json.simple.JSONObject;

ivory sleet
#

uh why json simple

heavy void
#

I used quick fix

#

This is my first time using json

ivory sleet
#

use gson or jackson or moshi

#

jsonsimple is outdated as hell iirc

#

and ftw gson is included in spigot

heavy void
#

Java 1.8 has Gson?

ivory sleet
#

no

#

but you can add it

#

just like simple json

heavy void
#

uh

#

;-

unreal quartz
dusk flicker
#

Gson is the best

quiet ice
#

I personally find the json reference implementation best

heavy void
#

"Cannot convert from JSONObject to JsonObject"...

#

How can i fix that?

drowsy helm
#

show code

#

you are using two different classes

heavy void
#

This is because my getDataContainer gets a JSONObject output.

#

But i dont want to change all the code.

quiet ice
#

Then make it deserialize it to JsonObject

#

the lazy way would be to just serialize it to string and then back, but this is very inefficent

heavy void
#

I only want to convert JSONObject to JsonObject in this part ;-

near crypt
#

you have to compare two Materials with == right?

quiet ice
#

No

#

You can, but you are not limited to it

near crypt
#

i mean not with .equals but with == right?

#

iam lost ik

quiet ice
#

You can compare enums in at least 3 ways

opal juniper
#

i mean it is the "best practice" iirc, coding convention

#

at least, its the way most common people do it

quiet ice
#

equals, name, ordinal and instance comparision

#

Only instance comparision is null safe, so most people use it

near crypt
#

and instance comparison is ==?

eternal oxide
#

@opal juniper My algorithm is getting better. It always find the target now. It does also find over 700 thousand paths to get there, but its improving

quiet ice
#

Yea

near crypt
opal juniper
quiet ice
#

.equals is equals

eternal oxide
near crypt
#

so if you compare two strings you have to use ==?

#

not string objects

quiet ice
# heavy void I only want to convert JSONObject to JsonObject in this part ;-

You should have opted in for one JSON framework and not multiple. Java unfortunately does not have a giant inbuilt library that holds all the classes all the libraries wish to use, so you have to use 200 classes for basically the same thing and need to manually convert it back and forth.
But even with a giant inbuilt library, most library devs will still create their own classes because "oooh, android does not work with that shiny library"

eternal oxide
#

and it checks every permutation of every BlockFace for every possible node

unreal quartz
#

strings are objects

quiet ice
#

as long as you know that they have to be interned, yes

near crypt
#

yeah ik

quiet ice
#

If not, no, not at all

opal juniper
eternal oxide
#

very

#

trying to limit a little now

opal juniper
#

okeeee

quiet ice
#

You compare most things with the equals methods in java - there are a few things (1 instance = 1 state structures - such as enums or interned strings) that allow for "good" instance comparison support

#

That being said, sometimes it may be recommended or even required to use instance comparision instead of equals despite the object structure usually not supporting it, but these cases will be rather rare so you should bother about them

heavy void
quiet ice
#

Okay, then you are forced to convert it manually.

minor garnet
#

so, someone have any idea to make implement lag compensation ?

quiet ice
#

depends on context

minor garnet
#

what

quiet ice
#

well, lag compensation will be quite different for a game that has a ping implementation that can be easily spoofed compared to a telegraphing service

minor garnet
#

well I didn't understand anything, I just wanted to know how to take a previous position from other players and emulate it

supple elk
#

is the angle in degrees or radians?

minor garnet
unreal quartz
supple elk
#

why tf is it in rads

smoky finch
#

You can easily convert degrees to radians tho

#

As for why, it's because that's what Java's Math class uses.

quiet ice
smoky finch
#

lol geol

quiet ice
#

I read it as "what tf is rads"

supple elk
#

lol

#

fortunately I do know what rads are

unreal quartz
#

unit of radiation in fallout 4 🙂

supple elk
#

player rotation is given in degrees tho from -180 to 180

quiet ice
#

While radians are more or less obscure for humans, they make more sense in most mathematical application

#

Which is why within the UI rotation is often given in degrees where as internally it may or may not be in radians

supple elk
#

right

hollow lagoon
#

Hello, I wanted to know what the getClikedBlock returns.

unreal quartz
#

?google

undone axleBOT
dusk flicker
#

?jd

hollow lagoon
#

I know but there is just mark that it returns the block but what the itemstack or the rental because I need the rental

unreal quartz
#

the.. rental?

hollow lagoon
#

location ?

unreal quartz
#

oh

hollow lagoon
#

sorry im french

unreal quartz
#

well it returns Block

hollow lagoon
#

thank you

heavy void
#
JSONObject varfd = profile.getDataContainer("arUtilsBedWars", "favorites").getAsJsonObject();

JsonObject favoritedata = new JsonParser().parse(varfd.toString()).getAsJsonObject();
#

this will work?

dusk flicker
#

You are using two diff Json objects

heavy void
#

I need to use 2 diff json objects

#

The dependency plugin uses JSONObject, but i need to use JsonObject.

dusk flicker
#

Try it and see

#

What libraries are both of them from?

#

I believe the top one is gson which is one of the best

heavy void
#

varfd is simple json

#

favoritedata is gson

dusk flicker
#

Ahh

#

Yeah it may work as a converter

serene agate
#

when i try getting item.getItemMeta().getDisplayName() it keeps returning an empty string

#

what am i doing wrong?

hasty prawn
#

getItemMeta

serene agate
#

this is a normal item btw

#

woops i meant that

hasty prawn
#

It's probably not named anything then

serene agate
#

how do i get the items default name?

#

like i just want "Wooden Sword"

hasty prawn
#

Get the Material name is all I know of

serene agate
#

item.getType().name() gives WOODEN_SWORD

#

oof

hasty prawn
#

Format it how you want then, replace _ with spaces and use StringUtils.capitalizeFully

serene agate
#

ig that can work yh

serene agate
#

do i just download that and chuck that in externallibraries folder?

hasty prawn
#

It should be included with Spigot

serene agate
#

nothing comes up 😦

quiet ice
hasty prawn
#

Try StringUtil

near crypt
#

how can i check the enchantment of an item? like this?: if(event.getItem().getItemMeta().getEnchants().equals(Enchantment.whatever))

quiet ice
#

That being said, I think you could use translation keys? I never did it myself so idk

serene agate
#

ty

near crypt
#

okay

hasty prawn
serene agate
quiet ice
#

It is somewhat working after 1.13 but earlier it would be a desasterous idea

hasty prawn
#

True, I always build against latest though

quiet ice
#

if .getEnchants() returns a collection it is .contains, if it returns a map it is .containsKey

hasty prawn
#

There's about a billion utils named similarly and I can't remember what methods are under what lmao

serene agate
#

yh wordutils was the one that was from apache

#

it wasnt coming up in my ide

hasty prawn
#

🤔

serene agate
#

u reckon its better to take some capitalize method off of stack overflow or dl the apache library for this?

hasty prawn
#

I'm fairly certain the apache library is already included in Spigot

#

What's the one liner? Curious now

#

replaceAll supports RegEx in Java 8 I thought

serene agate
#

im checking the directory list and it only shows bukkit and spigotmc libraries

hasty prawn
#

Ah

#

Right, gotcha now ty

serene agate
#

its probably not a good idea to import a 2mb library just to capitalize the first letters of words 😭

#

cant find the method :/ searched spigot capitalize and there doesnt seem to be any methods like that under spigot

opal juniper
#

Hello juice man

serene agate
#

what is the difference between the spigot environment and the spigot api?

opal juniper
#

spigot environment is the server

serene agate
#

i only have spigot api in my external libraries folder

opal juniper
#

the api is purely spigot / bukkit shit

serene agate
#

ah

eternal oxide
#

@opal juniper ok I have the algo quite good. So long as you are reasonably close

opal juniper
eternal oxide
#

it will fail to find a path

opal juniper
#

ohhhh