#help-development

1 messages Β· Page 1683 of 1

crude charm
#

It doesn't name it main tho

quaint mantle
#

Hello @waxen plinth .
In RedLib, is there a technical limitation that explains why ItemUtils and ItemStackBuilder Constantly returns new instances instead of modifying current item ? Or is it simply a choice you made ?

echo basalt
#

<plugin name>Plugin

crude charm
#

I call it pluginname

echo basalt
#

like

#

If I'm making a tutorial

unreal quartz
echo basalt
#

It's gonna be TutorialPlugin

eternal oxide
unreal quartz
#

neither

eternal oxide
#

I use Eclipse

waxen plinth
#

But it's so that you can do stuff like this

vast sapphire
#

True means I placed the block and it gets tracked however when I break the block it's not tracked anymore? is the PlayerBlockTracker plugin failing?

echo basalt
quaint mantle
#

My installed jdk jre thing in my plugin is jdk-16.0.1 and that is the highest java version I have installed. Does that mean I have to change my server version?

waxen plinth
#
ItemStack item1 = new ItemBuilder(blah).blahblah().blah();
ItemStack item2 = ItemUtils.rename(item1, "thing");```
unreal quartz
#

i use intellij but the plugin literally broke my ide when i installed it years ago, so i never used it again

vast sapphire
eternal oxide
echo basalt
#

thanks spigot for your raytracing detecting Player

waxen plinth
#

I get that making new items each time wastes some memory but it's never caused any issues so I won't prematurely optimize

waxen plinth
vast sapphire
waxen plinth
#

I sort of just expected I might have to lol

echo basalt
waxen plinth
#

I can switch it over if you have qualms with it

quaint mantle
echo basalt
#

like clicking on it detects itself

waxen plinth
#

But it wouldn't make that much of a difference to be honest

#

getItemMeta creates a new instance every time

#

ItemUtils would still be about as wasteful, you could preserve the ItemMeta with the builder I guess but I've never seen anyone have issues with the performance of creating items

crude charm
#

I never use ItemStack

waxen plinth
#

πŸ€”

crude charm
#

I use an ItemBuilder

unreal quartz
#

guess what that uses

crude charm
#

but to make ItemStacks

waxen plinth
#

Yes we're talking about my library's item builder here lmao

crude charm
#

oh

waxen plinth
#

Thank you for your contribution

crude charm
#

sorry

waxen plinth
#

It's cool lol

#

Just funny

quaint mantle
# waxen plinth ```java ItemStack item1 = new ItemBuilder(blah).blahblah().blah(); ItemStack ite...

I see. Thank you for your answer
In fact changing that would not only be for optimization reasons. In some cases we need to modify the current ItemStack. Doing so avoids having to replace it in the player inventory by some modified clone. It can be nice to make the code shorter and cleaner.
Also, the ability to chain builder methods does not rely on recreating object. For example:
ItemBuilder setName(String name) can both modify the name of the ItemBuilder (ItemBuilder = ItemStack) without creating a new one and, in addition, returns the same ItemBuilder.

waxen plinth
#

I can change how ItemBuilder works

#

It would make more sense for it to be that way

quaint mantle
#

I think that too. But don't do it for me. I had to extract and include that part of your lib in my project (since I did not want the whole lib for my needs) so I don't need it myself.

waxen plinth
#

It can be shaded, you know

quaint mantle
#

Yeah but I want to avoid have things unrelated to items management in my item management lib.

waxen plinth
#

Ahh, you're making a library of your own

#

That makes sense

#

By the way, I have a support discord you could join, would probably be a better place to ask these questions

quaint mantle
#

That lib contains some particular things (translation, ability to add events with conditions/actions on items, ...)

waxen plinth
#

Actually come to think of it, setItemMeta would need to be called every time via ItemBuilder since there is no build method to end the chain

quaint mantle
#

Ok then send me the link privately if you want ^^

waxen plinth
#

So I'm not sure there would be much of a point to making the ItemBuilder retain it

ember crag
#

how can i detect when a player jumps?

waxen plinth
#

You can't, not directly

#

Well actually I think there might be a stat for it but that's provided by the client if I recall

#

Can be spoofed

quaint mantle
ember crag
#

i know paper has its own jump event, but im trying not to use it

quaint mantle
#

Umm?

 Ambiguous plugin name `CreeperSpawn' for files `plugins\CreeperSpawn2.jar' and `plugins\CreeperSpawn.jar' in `plugins'
echo basalt
quaint mantle
#
   @EventHandler
   public void onMove(PlayerMoveEvent event) {
       Player player = event.getPlayer();

       /* Check that:
          - positive vertical velocity (avoir ladder case)
          - Not swiming or jumping out water
          - Not flying
          - Checking that player actually gone up during this move

          Will be true if the player jumps or if he is sent up by explosions.
       */
       if (!player.isOnGround &&
               player.getVelocity().getY() > 0 &&
               !event.getFrom().getBlock().isLiquid() &&
               !player.isFlying() &&
               event.getFrom().getBlockY() < event.getTo().getBlockY()
       ) {
           //...
           // On jump ...
       }
   }
#

@ember crag

waxen plinth
#

Wouldn't that fire multiple times per jump

waxen plinth
#

It's provided by the client

echo basalt
#

^

crude charm
#

if so then yeah thats an issue

echo basalt
#

you gotta check for the block below

#

snow layers gonna be a pain

eternal oxide
#

it may fail on teh velocity though

quaint mantle
#

hmmm. I hadn't the problem but in the context of my needs I suppose it wasn't an issue.
Don't hesitate to share a better code extract :/

shadow tide
#

I'm learning how to make plugins and when exporting I get this error message: ```JAR creation failed. See details for additional information.
Resource is out of sync with the file system: '/plugin/src/plugin.yml'.
Resource is out of sync with the file system: '/plugin/src/plugin.yml'.

eternal oxide
#

If Eclipse press F5

shadow tide
#

k

#

thanks

quaint mantle
#

Anyway I will do the modification on my side and send you the files back. It have some diffs with your original classes so you will not be able to include it easily but It may still be quicker than doing it yourself ^^

#

I also completed ItemStackTrait

shadow tide
#

I got this error message when starting my server, I don't know what part of it is important but here: [20:28:38] [Server thread/ERROR]: Could not load 'plugins\plugin.jar' in folder 'plugins' org.bukkit.plugin.InvalidPluginException: Cannot find main class `com.CJendantix.plugin.Plugin' at org.bukkit.plugin.java.PluginClassLoader.<init>(PluginClassLoader.java:69) ~[spigot.jar:3231-Spigot-3c1fc60-e167f28] at org.bukkit.plugin.java.JavaPluginLoader.loadPlugin(JavaPluginLoader.java:145) ~[spigot.jar:3231-Spigot-3c1fc60-e167f28] at org.bukkit.plugin.SimplePluginManager.loadPlugin(SimplePluginManager.java:394) ~[spigot.jar:3231-Spigot-3c1fc60-e167f28] at org.bukkit.plugin.SimplePluginManager.loadPlugins(SimplePluginManager.java:301) ~[spigot.jar:3231-Spigot-3c1fc60-e167f28] at org.bukkit.craftbukkit.v1_17_R1.CraftServer.loadPlugins(CraftServer.java:400) ~[spigot.jar:3231-Spigot-3c1fc60-e167f28] at net.minecraft.server.dedicated.DedicatedServer.init(DedicatedServer.java:233) ~[spigot.jar:3231-Spigot-3c1fc60-e167f28] at net.minecraft.server.MinecraftServer.x(MinecraftServer.java:1010) ~[spigot.jar:3231-Spigot-3c1fc60-e167f28] at net.minecraft.server.MinecraftServer.lambda$0(MinecraftServer.java:305) ~[spigot.jar:3231-Spigot-3c1fc60-e167f28] at java.lang.Thread.run(Thread.java:831) [?:?] Caused by: java.lang.ClassNotFoundException: com.CJendantix.plugin.Plugin at org.bukkit.plugin.java.PluginClassLoader.loadClass0(PluginClassLoader.java:142) ~[spigot.jar:3231-Spigot-3c1fc60-e167f28] at org.bukkit.plugin.java.PluginClassLoader.loadClass(PluginClassLoader.java:99) ~[spigot.jar:3231-Spigot-3c1fc60-e167f28] at java.lang.ClassLoader.loadClass(ClassLoader.java:519) ~[?:?] at java.lang.Class.forName0(Native Method) ~[?:?] at java.lang.Class.forName(Class.java:466) ~[?:?] at org.bukkit.plugin.java.PluginClassLoader.<init>(PluginClassLoader.java:67) ~[spigot.jar:3231-Spigot-3c1fc60-e167f28] Again just ask for any extra details

quaint mantle
shadow tide
#

what does that mean, like I just started making plugins, my only experience is making mods

quaint mantle
#

some time the next line does not give so much information (if it is in org.bukkit or org.spigot packages)

#

in your case the only thing to read is that the class "com.CJendantix.plugin.Plugin" could not be found at runtime.

#

Btw when I read "com.CJendantix.plugin.Plugin" I see some bad practices:

  • Please avoid using caps in your packages names. only lowercase (no special chars either).
  • Please don't call you main class Plugin. Prefer <MyPluginName>Plugin. For example: LeaverBanPlugin.
#

(I don't suggest you to ban each player who leaves your server xD)

shadow tide
#

this is just a learning experience so I'm just adding everything I learn into it and tweaking it. its meant to be general.

quaint mantle
#

The fact a class is not found at runtime can come from many reasons:

  • A library that is not fully included (shadowed) in your final jar for example (check your dependencies scope in maven/gradle).
  • An issue that randomly happened during compilation (just build your project again).
#

And this list is obviously not exhaustive ^^

shadow tide
#

the dependencies are fine I think, how do I check

#

I remember adding them but it was tedious so I don't remember how

quaint mantle
#

build.gradle file (if using gradle)
pom.xml (if using maven)

shadow tide
#

I'm not using either

quaint mantle
#

ok so it's directly in eclipse/intellij/... project configuration.

shadow tide
#

yeah

#

I'm using eclipse

quaint mantle
#

but first, is the missing class (the one in the error) in your project or is it comming from a dependency ?

shadow tide
#

project

quaint mantle
#

So it's unrelated to dependencies

shadow tide
#

k

#

it could be my plugin.yml

eternal oxide
#

What did you put in your plugin.yml as your main?

shadow tide
#

but its not

quaint mantle
#

So it's probably about project structure.
plugin.yml issue indeed
else package with caps
else project sources folder in project config
else build again.

shadow tide
#

?

quaint mantle
#

ok

#

i have a question.

shadow tide
#

else project sources folder in project config

quaint mantle
#

im asking to ask

shadow tide
#

what dat

quaint mantle
#

im trying to think of my question actually sorry

#

its... File#mkdirs(); to create a FOLDER, yes??

shadow tide
quaint mantle
#

??????

#

ok let me

#

give me just 2 seconds

#

im just confused

#

why is it a File if im .mkdir()ing it

eternal oxide
#

File is just a pointer to a location. it can be nothign, a directory or a file

vast sapphire
#

Does this work for broken blocks? I need it to work so when I break a tracked block, I get 1 of that block but with any other block I get 2 of the block

quaint mantle
# shadow tide `else project sources folder in project config`

First, as ElgarL said, check that in plugin.yml specifies a main
example:
main: my.package.MyMainPluginClassThatExtendsJavaPlugin

More infos here: https://www.spigotmc.org/wiki/plugin-yml/

Then to answer you about source folder:
When creating a java project you can define what folder will contain what.
A folder can contain sources (a source file is a file endings with .java and that will be compiled)
A folder can contain resources (a resource file can be modified automatically (=filtered) but usually it's simply a file that should be copied as it is in the final generated jar file. Example: plugin.yml)

quaint mantle
#

because i cant

eternal oxide
#

calling mkdir() creates teh directory tree if it doesn;t exist

rare stump
#

Help

eternal oxide
#

it doesn;t create files

rare stump
#

I have a major problem with my flight controls code

quaint mantle
#

idk how to create directories then i guess

shadow tide
rare stump
#

How do I drop an image

quaint mantle
#

same thing

quaint mantle
eternal oxide
undone axleBOT
quaint mantle
#

is there like something im missing

eternal oxide
eternal oxide
#

if (!file.exists()) file.mkdir()

#

then create your file

quaint mantle
#

yeah i have that

#

File logFile = File(getDataFolder(), "logs"); would work better

eternal oxide
#

how are you creating your actual file?

eternal oxide
#

not the File pointer. How are you creating the actual file

shadow tide
#

this is the opposite of what you said By convention, Java type names usually start with an uppercase letter

quaint mantle
#

File#createNew()

#

or whatever it is?

quaint mantle
shadow tide
#

ik

rare stump
#

Help

#

I have a question

quaint mantle
#

package = lowercase
class = CamelCase

rare stump
#

Is it possible for me to use steam to connect my flight controls to minecraft?

#

Need to do it for a sick video

quaint mantle
#

oh

#

im just stupid

quaint mantle
#

idiot

#

if(true) create file

#

LMAOOO

shadow tide
#

gtg

vast sapphire
#

I can't use the PlayerBlockTracker api in that event java final Block brokenBlock = event.getBlock(); if (PlayerBlockTracker.isTracked(brokenBlock)) { event.setCancelled(true); simply won't work

quaint mantle
vast sapphire
#

how do I get a broken block in BlockDropItemEvent

#

What is e.getBlock in a BlockDropItemEvent?

tame fern
#

Is there a write up on the new ChunkGenerator information? Just swapped from 1.17 to 1.17.1 and half the methods I was using are depreciated.

#

Oh Nevermind, found it.

formal dome
#

can anyone send me an appropriate sql url example that works in their plugin? i'm using JDBC to connect to my localhost database

quaint mantle
#

jdbc:mysql://localhost:3306/somesampledb

#

but it depends from your database management system address/port/database name

formal dome
#

i use mysql

#

i was wondering if i'd need auth in there too

quaint mantle
#

I see. And no, it's well separated ^^

worldly ingot
#

Auth in a URL is probably a bad idea anyways lol

formal dome
unreal quartz
#

request body

#

or token in header

#

nevermind lol, did not read the context

quaint mantle
#

hey, how might one go about creating a void world?

spiral dome
#

πŸ‘½

quaint mantle
#

but BiomeGrid is deprecated

quaint mantle
quaint mantle
#

it works)

quaint mantle
#

ok it didnt work

#

wait

quaint mantle
#

How can I save all players' data that are cached in a hashmap database every 10 minutes?

drowsy helm
#

what sort of database

#

usually i make my own serializer

quaint mantle
#

After the player enters I store his data in hashmap

drowsy helm
#

just make a manager class that saves each variable to the db on a scheduler

quaint mantle
#

I want to make it save all data in the database every 10 minutes

#

this?

drowsy helm
#

yeah you could do that

#

a lot of serializers use reflection to get every field then auto save it

echo basalt
quaint mantle
#

I'm using asynchronous when pulling the function.

echo basalt
#

You're still gonna have a memory leak

quaint mantle
#

And I'm storing it in a hashmap to be cached

echo basalt
#

Still gonna leak

quaint mantle
#

What do you mean, could you explain it to me?

#

πŸ˜–

echo basalt
#

Alright, basically how this works is

#

On java, you can allocate objects to memory

#

When an object has no references, it gets garbage-collected (removed from memory)

quaint mantle
#

What about keeping multiple connections active?

echo basalt
#

But when an object has no references, yet can't be garbage collected for some reason

#

You have a memory leak

#

Guess what variables always stay loaded in RAM?

#

static variables

quaint mantle
#

πŸ‘€

#

oh

echo basalt
#

You also have to close statements and things like that

#

As they also stay open

#

Pretty sure you can close PreparedStatement, ResultSet and things like that

quaint mantle
#

I'm using hikariCP

echo basalt
#

Ehh

#

I'd probably just load all the player data onJoin and save it onQuit

#

With a timer every ~30 seconds or so

#

I really really recommend you learn how memory and the JVM works before diving into databases and such

quaint mantle
#

Basically I will do this.

#

it's a draft.

echo basalt
#

ScheduleSyncDelayedTask is still sync

#

also ew Β§ color codes

#

There are many code quality issues you should look into fixing honestly

#

I know databases might seem exciting but I don't want you to grow into bad practice

quaint mantle
#

oh, yes.

#

static methods

echo basalt
#

Not just

quaint mantle
#

?

echo basalt
#

There's a use for static

#

Static is made for variables that should be always loaded in memory

#

And effectively final

#

The JVM won't really try to actively garbage collect most static objects

#

But looking at your code it's cluttered and messy

#

You don't follow naming conventions, keep all your variables public, instead of having getters

#

Can't tell the difference between sync and async

vague oracle
#

Also you can just hover over runnable and it will turn it into a lambda for you

frosty tinsel
#

I think

vague oracle
#

Their code is literally suggesting it 🀦🏻

#

They are also using a runnable and not a bukkit runnable

#

Most likely copy and pasted code

frosty tinsel
#

,ou are right

#

I haven't looked in the code, so I assumed it's BukkitRunnable

vague oracle
#

Also @quaint mantle Isn’t the account manager creating a new account going to be running a Db query meaning that needs to be async

#

You can also just put the code where it adds the stats in the create and get account as it will save you having to schedule another task

rustic gale
#

when is PrepareItemCraftEvent called? i looked in java docs am I just blind

ivory sleet
chrome beacon
#

1.7 isn't supported anymore

chrome beacon
#

Wdym normal cow

#

NMS cow is the same as normal cow

#

It does

#

How else would it move

#

Cows do move in 1.15

#

Why would it move

#

That's a packet entity

#

It doesn't exist on the server

#

So ofc it doesn't move

#

Don't call a packet cow nms cow

#

NMS cow moves and exists on server

#

You will need to make your own system

#

You need to pathfind send packets etc

#

Or you know NOT spawn it with packets

#

Then use packets to remove it from others

#

Also no need for NMS cow here

opal juniper
#

use the destroy entity packet

torn shuttle
#

I have a fun issue today

#

dude says he's using a datapack item

#

it's slipping through my checks and through the checks of seemingly several other plugins

#

it errors on the return line

eternal oxide
#

the last line?

torn shuttle
#

yeah

eternal oxide
#

impossible

torn shuttle
#

that's what I said

#

line 28

#

yeah no doubt

#

it's some cursed shit, at least illegalstack is doing the exact same error

eternal oxide
#

if it were null the earlier test would haev caught it

torn shuttle
#

and yet here we are?

#

I mean is it at all possible datapacks have invented an innovative and fun way for inventories to cause errors

#

because we did not have enough of those

#

maybe we're checking for air and null but we should also be checking for Null, the new class by mojang

eternal oxide
#

The only thing I see thats odd is using .equals to check for AIR

torn shuttle
eternal oxide
#

have you tried a sysout on getCurrentItem() ?

eternal oxide
#

?stash

undone axleBOT
eternal oxide
#

or they are using AIR as a custom item, somehow. I don;t even know if thats possible in datapacks

torn shuttle
#

so they probably don't know if it's using air

eternal oxide
#

?paste

undone axleBOT
eternal oxide
#

I've never used datapacks, but shoudl that second line not start minecraft:air not just air? https://paste.md-5.net/

torn shuttle
#

paste's dead

eternal oxide
#

{id:"air",Count:1b,tag:{mfc:1b}}

torn shuttle
#

yeah that looks like an oversight

#

just contextually based on the other ids

eternal oxide
#

its in two places in teh datapack

#

in file data\minifurnace\functions\furnace.mcfunction

torn shuttle
eternal oxide
#

a single entity? No

#

depends how fast you spawn them

maiden briar
#

I still can't work with attributes, I want something like this:

  • An entity gets some base values like speed, damage, etc
  • I also want to upgrade it every kill with 5%
  • I want to get the values

I can't make the last two

eternal oxide
#

if you are spawnign with packets they don;t really exist on the server

#

so your limit is client side or bandwidth

ember skiff
#

Hello, can I register commands like this?
getCommand("clw get").setExecutor(...);
If yes, will "get" be in args as args[0] or not at all? Thanks for help

maiden briar
#

No spaces allowed

ember skiff
#

thanks

eternal oxide
#

You register teh root command only

maiden briar
#

you want to register as clw, and get is automatically args[0] if provided

ember skiff
#

And how do you write description of other than root commands? You just list them in plugin.yml?

maiden briar
#

Yes

#

But I still recommend just the root command as description, and create a help menu for sub commands

eternal oxide
#

sub commands don't go in the plugin.yml

ember skiff
#

Thank you for help

maiden briar
#

How can I despawn a Wolf temporary? I tried with .setInvisible and .setAI but that is not enough

eternal oxide
#

why is it not enough?

#

I'd setInvulnerable too though

maiden briar
#

Ok I will try it

#

Because they will still take damage, and players can't walk

eternal oxide
#

then setCollidable too

maiden briar
#

Ok

#

true or false?

eternal oxide
#

false

maiden briar
#

Ok thx and invulnerable also false?

eternal oxide
#

true

maiden briar
#

Ok thanks, I will test it

dense remnant
#

Is there a way to make a explosion created by createExplosion shieldable?
(When a creeper explodes, I can use my shield to block damage, doesnt work with that method)

#

Is there a way to just spawn an entityexplosion?

ember skiff
eternal oxide
#

if(sender.hasPermission

ember skiff
#

Again no need to list them in plugin.yml?

#

What is plugin.yml file used for? I would like to have deeper understanding

dense remnant
#

Its mainly for just registering the commands and telling the server that it is a plugin by giving him the plugin name & instructions on how to run it (main class)

maiden briar
#
wolf.setAI(false);
wolf.setInvisible(true);
wolf.setSilent(true);
wolf.setAngry(false);
wolf.setInvulnerable(true);
wolf.setCollidable(false);
eternal oxide
#

then teleport it way up in the air

maiden briar
#

Won't it fall?

eternal oxide
#

with no AI it will not be subject to gravity

maiden briar
#

Ok, then something like y=300 and then teleport it back if they want it visible again

#

Because it must not be reachable by build limit

#
Location location = wolf.getLocation();                        location.setY(location.getWorld().getMaxHeight() + 20);
wolf.teleport(location);
tacit drift
#

do you want to lag a player or what? 🀣

maiden briar
#

If i try to kick players from the server in onDisable it does not work if the server is reloading, they will get kicked later, or not and I even do not see my custom message

tacit drift
#

there is an event called before reloading

#

or PlayerCommandPreprocessEvent and listen for /reload

maiden briar
#

Ok good idea, thanks

maiden briar
tacit drift
#

that's wrong

#

i thought that there is an event

maiden briar
#

Ok then I will listen to the command event

#

There is also an ServerCommandEvent

tacit drift
#

that event is for console commands

maiden briar
#

Yes then I need to listen for both

tacit drift
#

and yeah, probably you would have to listen for that too

#

πŸ‘

tacit drift
#

yes

#

World#createExplosion

#

@dense remnant

dense remnant
#

That doesnt count as an entityexplosion

#

I want the explosion to be blockable with a shield

quaint mantle
#

can anyone help me with debugging? i am bad at it :p

vast sapphire
#

what event do I listen to if I want to check if an arrow is still in the air

#

ProjectileLaunch Event?

maiden briar
#

<T extends CustomFile>
Why does T.class.equals(getClass()) NOT work?

radiant aspen
#

what are u struggling with?

maiden briar
#

System.out.println

radiant aspen
#

Loggers πŸ‘€

#

also you can use actual breakpoints but thats just effort

paper viper
#

breakpoints save you much more time and sysouts

spice pecan
#

can someone help me, i need a tutorial of the pluigin geiserbungecoord please

paper viper
#

you dont have to recompile everytime for a sysout statement

undone axleBOT
quaint mantle
radiant aspen
#

your going to have to be more specific

spice pecan
radiant aspen
#

im not psychic

ivory sleet
#

Oh

#

That’s because of type erasure

maiden briar
#

Yes I read that

#

But what to solve it?

ivory sleet
#

When running T will just be CustomFile

#

Well pass a parameter of Class<T> cls then use cls == getClass()

maiden briar
#

I am create a method with will automatically return the class without casting, but I need to know if T is a YamlConfigFile.class (extends CustomFile) or just a raw one

quaint mantle
# radiant aspen your going to have to be more specific

I'm making it so that a cobble gen generates random ores, and i am trying to debug why it does not work

    private static final Material[] MATERIALS = new Material[]{
            Material.COBBLESTONE,
            Material.STONE,
            Material.COAL_ORE
    };

    public Material getRandomMaterial() {
        final ThreadLocalRandom random = ThreadLocalRandom.current();
        return MATERIALS[random.nextInt(MATERIALS.length)];
    }

    @EventHandler
    public void onCobbleGen(BlockFormEvent event) {
        if (event.getBlock().getType() == Material.COBBLESTONE) {
            event.getBlock().setType(Material.AIR);
            event.getBlock().setType(getRandomMaterial());
        }
    }
spice pecan
#

I need the custom geyser-bungeecord plugin

maiden briar
spice pecan
#

:c

maiden briar
#

But I just can't return getClass

ivory sleet
#

Elaborate

maiden briar
#

?

ivory sleet
#

Anyways you need to pass a type aware argument if you want type aware returns

formal dome
# quaint mantle jdbc:mysql://localhost:3306/somesampledb

using this and replacing in my desired database just results in this error: ```Establishing SSL connection without server's identity verification is not recommended. According to MySQL 5.5.45+, 5.6.26+ and 5.7.6+ requirements SSL connection must be established by default if explicit option isn't set. For compliance with existing applications not using SSL the verifyServerCertificate property is set to 'false'. You need either to explicitly disable SSL by setting useSSL=false, or set useSSL=true and provide truststore for server certificate verification.

maiden briar
#

Ok thanks

radiant aspen
#

so here


        if (event.getBlock().getType() == Material.COBBLESTONE) {

put a System.out.print before that that outputs what the blocktype is, if its not cobblestone you know your issue is there

quaint mantle
#

just the base sout method?

radiant aspen
#

I mean you can use whatever

#

just anything that outputs it

#

sout Loggers, Bukkit.broadcastMessage

hybrid spoke
#

you can also just exit the system everytime it works

quaint mantle
#

So for example?

public Method() {
        System.out.println();
}

Just like that? I have never done debugging in my life :p

hybrid spoke
#

seems like you have never done java in your life

quaint mantle
#

ok, harsh, but is it right?

hybrid spoke
#

you probably want to give yourself some informations with it

spice pecan
#

help me 😦

hybrid spoke
#

Γ‘ printing something (a l(i)n(e))

maiden briar
#

@ivory sleet I found this on StackOverFlow

T data = new Gson().fromJson("{}", new TypeToken<T>(){}.getType());
if(!data.getClass().equals(getClass())
....
quaint mantle
hybrid spoke
#

and if you want to debug everything

hasty prawn
#

It's easier to do if you don't put it in a method also

#

Just put the sout where you would call the method

hybrid spoke
#

it would probably look like this:

public void debuggingMyCoolStuff() {

  if(broken) {
    System.out.println("broken");
    return;
  }

  if(true) {
    System.out.println("true");
  } else {
    System.out.println("false");
  }
  System.out.println("done");
}
hasty prawn
#

a very useful if statement

hybrid spoke
#

if it prints false you should uninstall your computer

hasty prawn
#

Yep KEKW

ivory sleet
#

because T might get erased

maiden briar
#

Ok still thanks

ivory sleet
#

Usually something like
TypeToken<List<Map<String,Reference<Player>>>> token = new TypeToken<List<Map<String,Reference<Player>>>>(){};
would work because it's effectively the same as

class SomeToken extends TypeToken<List<Map<String,Reference<Player>>>> {

}
TypeToken<List<Map<String,Reference<Player>>> token = new SomeToken();

and in SomeToken the type List<Map<String,Reference<Player>>> cannot be erased since it has to be there at runtime due to explicit derivation (idr the actual term for it but yeah).

unreal quartz
#

jesus

#

tf is going on

quaint mantle
#

asdf

formal dome
#

anyone know the gradle dependency statements for hikariCP

unreal quartz
#

the same as maven but gradle

formal dome
unreal quartz
#

make sure you have mavenCentral() in your repositories

formal dome
unreal quartz
#

central in repositories, hikari in dependencies

formal dome
#

oh sweet

#

thanks

#

?paste

undone axleBOT
formal dome
#

ope don't need that, i got it to compile

vast sapphire
#

What event should I listen to for creating an explosion on an arrow while it's alive

hasty prawn
#

Like when it's in the air or when it hits something

vast sapphire
hasty prawn
#

ProjectileLaunchEvent will give you the arrow. You'll just have to figure out when to create the explosion so it's not exploding in their face

vast sapphire
#

?paste

undone axleBOT
formal dome
#

where is the db.properties file for my locally hosted sql server?

vast sapphire
quaint mantle
vast sapphire
hasty prawn
#

What do you mean "not working". What does it do?

vast sapphire
hasty prawn
#

Well for one you should be using runTaskTimer() instead of scheduleSyncRepeatingTask.

Add some souts, my guess is that shot is not being set to true.

vast sapphire
hasty prawn
#

I assume bow() returns an ItemStack?

vast sapphire
#

yes

hasty prawn
#

Do p.getInventory().getItemInMainHand().isSimilar(bow())

You should add a log line in that if statement too so you know it's being set.

hasty prawn
#

Then they aren't holding whatever bow() is returning.

vast sapphire
#

I am just going to get the item name

vast sapphire
vast sapphire
#

I get a true message

formal dome
#

ah so what method is triggered for every time the logger prints something to the console??

lost matrix
formal dome
hasty prawn
formal dome
#

oh gosh. each message has its own type possibly 😬

vast sapphire
hasty prawn
#

Sure

vast sapphire
#

even with this piece of code, it doesn't explode ```java
if (p.getInventory().getItemInMainHand().getItemMeta().getDisplayName().equalsIgnoreCase(name)) {
shot = true;
p.sendMessage("" + shot);

            while (arrow.isValid()) {
                arrow.getWorld().createExplosion(arrowLoc, 1);
            }
        }```
#

?

hasty prawn
#

Well if the arrow is valid you just stuck it in an infinite loop

vast sapphire
#

I know

vast sapphire
hasty prawn
#

Remove the arrow.isValid() check and print arrowLoc.

vast sapphire
#

ok

vast sapphire
hasty prawn
#

Send your code again

vast sapphire
#
        Arrow arrow = (Arrow) e.getEntity();
        Location arrowLoc = arrow.getLocation();
        Player p = (Player) e.getEntity().getShooter();
        String name = bow().getItemMeta().getDisplayName();
        if (bow() != null) {
            if (p.getInventory().getItemInMainHand().getItemMeta().getDisplayName().equalsIgnoreCase(name)) {
                shot = true;
                p.sendMessage("" + shot);
                    p.sendMessage(arrowLoc + "");

            }
                    Smp.instance.getServer().getScheduler().runTaskTimer(Smp.instance, () -> {
                        arrow.remove();
                        shot = false;
                    }, 0, 100);
                }```
hasty prawn
#

You're not creating an explosion anywhere in there PauseChamp

vast sapphire
#

No I removed it

#

It was in the while

hasty prawn
#

Put it back, just not in the while

vast sapphire
#

ok

vast sapphire
#

1 explosion happens

#

just need to to go on while the entity is alive

hasty prawn
#

That's what the Timer is for

vast sapphire
#

removing the arrow

#

it's 5 seconds long

vast sapphire
# hasty prawn That's what the Timer is for

Changed up my code ```java
@EventHandler
public void bowShoot(ProjectileLaunchEvent e) {
Arrow arrow = (Arrow) e.getEntity();
Location arrowLoc = arrow.getLocation();
Player p = (Player) e.getEntity().getShooter();
String name = bow().getItemMeta().getDisplayName();
World world = p.getWorld();
if (bow() != null) {
if (p.getInventory().getItemInMainHand().getItemMeta().getDisplayName().equalsIgnoreCase(name)) {
shot = true;
p.sendMessage("" + shot);

            Smp.instance.getServer().getScheduler().runTaskTimer(Smp.instance, () -> {
                p.sendMessage(arrowLoc + "");
                world.createExplosion(arrowLoc, 1);
            }, 0, 5);
        }
                Smp.instance.getServer().getScheduler().runTaskLater(Smp.instance, () -> {
                    arrow.remove();
                    shot = false;
                }, 100);
            }
        }``` i'm getting the world from the player and running the arrow.remove task later
#

still doesn't work

hasty prawn
#

How many explosions does it make? One in the same spot over and over?

hasty prawn
#

Does it print the location

vast sapphire
#

no

hasty prawn
#

Does it print anything...?

vast sapphire
#

no, it doesn't

#

what am I doing wrong?

hasty prawn
#

Then the if statement is failing again. Make sure you're holding the bow with the right name, and that the bow actually has a name.

normal flower
#

Can you make custom items using resource packs, without using durability items like hoes, swords, pickaxes, axes and shovels in 1.17? Whilst still preserving the original items. Like if I would add a new texture for the cyan_dye to simulate another item. Etc.

vast sapphire
#

that happens after the if

hasty prawn
#

You set it on the item and in the resource pack

vast sapphire
hybrid spoke
#

i mean you are using the result of bow() and checking AFTERWARDS if its null

#

the shooter is not always a player

vast sapphire
#

I removed null

hybrid spoke
#

make sure the name of the item is exactly your name string

#

ItemStack#isSimilar would make more sense here

#

cant really see what you did down there since its aids to look at it at the phone

#

but what is not working @vast sapphire

crimson terrace
#

is there a performance difference between using a single (for example) EntitySpawnEvent for many things and using many of these for each a single thing?

vast sapphire
hybrid spoke
#

arrowLoc probably null

#

you are using it outside the eventhandler

#

and its a local variable

#

inside the eventhandler

vast sapphire
# hybrid spoke you are using it outside the eventhandler

Nothing is being printed now and the variables are still in the eventhandler along with the runnables ```java
@EventHandler
public void bowShoot(ProjectileLaunchEvent e) {
Arrow arrow = (Arrow) e.getEntity();
Player p = (Player) e.getEntity().getShooter();
Location arrowLoc = arrow.getLocation();
World world = p.getWorld();
if (e.getEntity().equals(p)) {
if (p.getInventory().getItemInMainHand().isSimilar(bow())) {
shot = true;
p.sendMessage("Shot true line");

            Smp.instance.getServer().getScheduler().runTaskTimer(Smp.instance, () -> {

                p.sendMessage(arrowLoc + "");
                if (arrowLoc != null)
                world.createExplosion(arrowLoc, 1);
            }, 0, 5);

            Smp.instance.getServer().getScheduler().runTaskLater(Smp.instance, () -> {
                arrow.remove();
                shot = false;
            }, 100);

        }
    }
}```
hybrid spoke
vast sapphire
vast sapphire
quaint mantle
#

That would throw an error

hybrid spoke
#

a skeleton will make problems

#

oh and snowballs too, yeah

quaint mantle
#

Do a check if β€œevent.getEntity instance of Arrow” or something

hybrid spoke
#

same with shooter for Player

quaint mantle
#

Yup

tardy delta
#

if the permission string in the plugin.yml in not filled in, is the value null or just empty string?

quaint mantle
#

Or just don’t add it

vast sapphire
#

here is my code now: ```java
@EventHandler
public void bowShoot(ProjectileLaunchEvent e) {
Player player = (Player) e.getEntity().getShooter(); //Variables are now locally defined in runnables
Arrow projectile = (Arrow) e.getEntity();
if (e.getEntity().getShooter() != null && e.getEntity() == projectile) {
if (player.getInventory().getItemInMainHand().isSimilar(bow())) {
shot = true;
player.sendMessage("Shot true line");

            Smp.instance.getServer().getScheduler().runTaskTimer(Smp.instance, () -> {
                Arrow arrow = (Arrow) e.getEntity();
                Player p = (Player) e.getEntity().getShooter();
                Location arrowLoc = arrow.getLocation();
                World world = p.getWorld();
                p.sendMessage(arrowLoc + "");
                if (arrowLoc != null)
                world.createExplosion(arrowLoc, 1);
            }, 0, 5);

            Smp.instance.getServer().getScheduler().runTaskLater(Smp.instance, () -> {
                Arrow arrow = (Arrow) e.getEntity();
                arrow.remove();
                shot = false;
            }, 100);

        }
    }
}```
hasty prawn
#

You're still going to have casting issues, and really the only thing that needs to be defined in the Runnable is the Projectile location.

quaint mantle
#

Also why have you got like 3 runnable?

#

Well tasks

hasty prawn
#

There's nothing wrong with the Runnables themselves

quaint mantle
#

I know but it’s a bit aids πŸ˜‚

hasty prawn
#

Make explosion at the arrow every 5 ticks, stop doing that after 100 ticks

quaint mantle
#

Imagine 10 people shooting

#

That’s 30 tasks

#

-_-

#
  • all the skeletons
hasty prawn
#

How would you do it? You could make 2 static Runnables in theory but that would involve storing the Projectiles in a list

#

Which is just a pain KEKW

quaint mantle
#

What’s he trying to do exactly?

#

Make explosive arrows?

hasty prawn
#

Create explosions on flying arrows.

quaint mantle
#

Well I’d have one runnable

#

That starts when he shoots

#

And creates the effect whilst it’s moving

vast sapphire
quaint mantle
vast sapphire
quaint mantle
#

Good

vast sapphire
#

still doesn't work

quaint mantle
#

What bit doesn’t work?

#

You registered your listener πŸ˜‚

#

??

vast sapphire
quaint mantle
#

Okay just some people don’t lmfaoo

hasty prawn
vast sapphire
hasty prawn
#

No need for the 100 tick removal thing

vast sapphire
hasty prawn
#

Are arrows affected/killed by explosions?

#

Idek

vast sapphire
hasty prawn
#

Oh

#

What you're doing is fine then, regarding that.

vast sapphire
# hasty prawn What you're doing is fine then, regarding that.

why is it not creating an explosion then? ```java
@EventHandler
public void bowShoot(ProjectileLaunchEvent e) {
Player player = (Player) e.getEntity().getShooter(); //Variables are now locally defined in runnables
if (e.getEntity() instanceof Arrow) {
Arrow arrow = (Arrow) e.getEntity();

        if (e.getEntity().getShooter() instanceof Player && e.getEntity() == arrow) {
            if (player.getInventory().getItemInMainHand().isSimilar(bow())) {
                shot = true;
                player.sendMessage("Shot true line");

                Smp.instance.getServer().getScheduler().runTaskTimer(Smp.instance, () -> {

                    Location arrowLoc = arrow.getLocation();
                    World world = player.getWorld();
                    player.sendMessage(arrowLoc + "");
                    if (arrowLoc != null)
                        world.createExplosion(arrowLoc, 1);
                }, 0, 5);

                Smp.instance.getServer().getScheduler().runTaskLater(Smp.instance, () -> {
                    arrow.remove();
                    shot = false;
                }, 100);

            }
        }
    }
}```
tacit drift
#

send arrowloc

#

in system.out

#

or chat

#

to see what it retuns

#

basically, do debugging

#

after every if send something to console or chat

vast sapphire
#

the if statements work

crimson terrace
#

Im trying to make my plugins performance better and I have a few questions for someone who knows stuff about it.

  • should I make variables instead of calling config.get whenever I need it?
  • is there a difference in performance between using multiple events that could be made into one or not?
  • any other way of improving performance?

Im not really having problems with performance but its always nice to save those nanoseconds πŸ™‚
(posted into help server by accident, lol, deleted it there now)

unreal quartz
#
  • depends
  • depends
  • probably
tardy delta
#

if you use config.get() with the same argument give it a variable

waxen plinth
#

If you're accessing very frequently use a variable

#

Otherwise doesn't really matter

crimson terrace
waxen plinth
#

For events, having multiple listeners isn't a big deal but try to avoid registering one per something

#

For example if 10 players have protected areas don't have 10 listeners for the events to protect those areas

waxen plinth
#

Or a config framework

#

I have one you could use which loads all the data from config into variables automatically

crimson terrace
#

?paste

undone axleBOT
crimson terrace
waxen plinth
#

Doesn't seem very OOP but I guess it works

crimson terrace
#

im kinda new to Java so if you know a better way I would love to know that. πŸ˜„

waxen plinth
#

It'd be overkill for something like this

#

But I would probably make an enum for the different types

#

Map them to weights

#

And load them into a weighted random from config

#

Then when a fireball is launched, roll the weighted random to see what outcome to apply

crimson terrace
#

currently I have a setup like that, hold on.

waxen plinth
#

Ideally each enum would contain a lambda which could handle it so you wouldn't have repetitive code

crimson terrace
#

my own version tho XD

#

and not as sophisticated

#

I roll a random number and see which one it applies to

waxen plinth
#

That's really not at all what I described and is also a bastardization of probability

#

It won't work if the numbers don't add up to 100

crimson terrace
#

for a weighted system instead of % i could just set rn to Methods.randomNumber(0, (sum of all chances))

#

if the numbers are under 100% it just means that the blaze will shoot a normal fireball as it is supposed to. if its over the chances wont work properly tho.

waxen plinth
#

That's why you add a fourth option for a normal fireball

#

I have a weighted random utility class you can steal if you want

crimson terrace
#

I would love to steal that!

waxen plinth
crimson terrace
#

ive never understood the T people put in their class<>

waxen plinth
#

It's a generic

#

List<Integer>

crimson terrace
#

might learn that next semester then... XD

waxen plinth
#

I'm sure you have seen that before right?

#

It's not hard

#

<T> just means the type is generic

#

List<T> means you tell it what <T> is when you make it

crimson terrace
#

oh that makes sense

waxen plinth
#

So, List<Integer> list = new ArrayList<>();

#

This is saying "this is a list of integers"

#

Java is statically and strongly typed

#

If it didn't have generics, you'd just have to have List return Objects

#

And cast

#

That's what we actually had to do in the first version of java

#

But generics are a way of saying that a type exists in relation to another type

crimson terrace
#

oh i get it. thats why you have a map with <T, Double>. so you can tell it what type the name or whatever is when you get to it

waxen plinth
#

You never have just a List, it's always a list of something

waxen plinth
#

That map maps the type it rolls for to their weights

crimson terrace
#

ye

waxen plinth
#

So you can have it roll and return whatever

#

My library also has a config manager you could use for loading data from config easily but that might be a bit advanced if you're new to java

crimson terrace
#

sounds too complicated. I might just have to keep coding until my profs get to the generics. thank you so much for explaining it tho πŸ˜„ I understood a good amount more from that πŸ™‚

waxen plinth
crimson terrace
#

ye, thats me.

#

thanks for your time tho πŸ™ƒ

dense remnant
#

Is there any way to summon a player lit tnt?

crimson terrace
#

summon a lit TNT and then set the source

maiden briar
#

Hello, My friend gets ping bot attacks to his server. The ip-addresses are always different and they ping the server millions a second. The problem is on a Bungee proxy

#

Can I write a plugin to protect him?

quaint mantle
#

just scan for a ping event and null the ip after like

#

10/second?

maiden briar
#

How would I do that in code?

quaint mantle
#

idk

#

thats what my host does

#

so idrk

maiden briar
#

Ok thanks for the idea

eternal oxide
#

or aer they attacking bungee?

maiden briar
#

Oh I said it wrong, his Spigot servers UNDER Bungee are getting attacked

eternal oxide
#

Yes, why are his servers IP's exposed?

maiden briar
#

I don't know that

proud basin
#

sr.getScaledWidth() - (width / 2) should get me the center correct?

quaint mantle
#

yeah

#

it should

eternal oxide
#

he needs to read teh section on securing his network on the installing bungee wiki

severe oracle
#

What is the beat way to create hologram text displays?

proud basin
#

that's what I thought

#

weird that it doesn't center it

eternal oxide
quaint mantle
#

oh

#

am dumb

eternal oxide
#

so you need (windowWidth / 2) - (width / 2)

quaint mantle
#

oh ya

proud basin
#

oh

#

that didn't center it

eternal oxide
#

you need the MC window width, not sure what sr is

proud basin
#

it's the window width

eternal oxide
#

I'd doubt that. It has a reference to scaled so I'd guess thats somethign to do with UI

proud basin
#

ui screen?

eternal oxide
#

probably

proud basin
#

wouldn't I want to use that anyways

eternal oxide
#

if you are going to scale everything depending on teh UI scale setting

#

you can always sysout and see what its value is

proud basin
#

I've been using ScaledRes for everything

#

didn't I test that before

eternal oxide
#

I remember you found an mc.width or something

proud basin
#

so sr is half of the window size?

#

427/854

eternal oxide
#

if its half then you don;t need to divide the first by 2

proud basin
#

its like to the right a bit

#

like before

proud basin
#

but doesn't center it

eternal oxide
#

then you are adding somethign and moving it right, or those values are not correct

proud basin
#

could it be the image size?

#

can that effect it

eternal oxide
#

I thought width was the width of what you are drawing

proud basin
#

I'm trying to put a image at the top center

#

but I already got it to the top I just need to center it

eternal oxide
#

use teh width of whatever you are drawing

proud basin
#

i am

eternal oxide
#

Yes, IF width is teh width of the thing you are drawing

proud basin
#

the width of itis 120

#

it is

tidal socket
#

Hi, i need to send a particle packet to a player using protocollib. I have written this, but it kicks the player saying: io.netty.handler.codec.EncoderException: java.lang.NullPointerException: Cannot invoke "net.minecraft.core.particles.ParticleParam.getParticle()" because "this.j" is null.
Why?
https://pastebin.com/uWR40sUY

This is the page that i'm using: https://wiki.vg/Protocol#Particle

proud basin
#

No values inside of it

eternal oxide
#

paste teh full error

proud basin
#

I don't even see this.j in your code

eternal oxide
#

he's reading an nms line from the error stack

tidal socket
#

In fact i'm not using a J variable

proud basin
#

elgar this is what im doing drawModalRectWithCustomSizedTexture(sr.getScaledWidth() - (width / 2), 0, 0.0F, 0.0F, 120, 100 ,120, 100);

eternal oxide
#

why are you hard coding teh width values?

#

120,100

#

those are texture width yes?

proud basin
#

yea

eternal oxide
#

can you not get those values instead of hard coding?

tidal socket
eternal oxide
#

show full errors or its unlikely anyone can help

#

is your protocol lib full yup to date?

tidal socket
#

The version of the official spigot page

eternal oxide
#

your error seems to indicate you are only getting a single Integer, so you can't write 1,100

tidal socket
vast sapphire
#

why is there no explosion at arrowLoc? ```java
@EventHandler
public void bowShoot(ProjectileLaunchEvent e) {
Player player = (Player) e.getEntity().getShooter();
if (e.getEntity() instanceof Arrow) {
Arrow arrow = (Arrow) e.getEntity();

        if (e.getEntity().getShooter() instanceof Player && e.getEntity() == arrow) {
            player.sendMessage("shooter");
            if (player.getInventory().getItemInMainHand().isSimilar(bow())) {
                shot = true;
                player.sendMessage("Shot true line");
                final int[] count = {0};
                Bukkit.getScheduler().scheduleSyncRepeatingTask(instance, new Runnable() {
                    @Override
                    public void run() {
                        player.sendMessage("runnable on "+ count[0]++);
                        Location arrowLoc = arrow.getLocation();
                        World world = arrowLoc.getWorld();
                        world.createExplosion(arrowLoc, 1);
                    }
                }, 0, 20);

            }
        }
    }
}``` I implemented the run method this time and still nothing.
eternal oxide
#

Definitely says you only have 1 to play with Field index out of bounds. (Index: 1, Size: 1)

tidal socket
#

Sorry, can you see this?

#

I have 2 field type for integer

eternal oxide
#

sysout packet.getIntegers().size()

tidal socket
#

Should I try this?

eternal oxide
#

nah don;t bother

chrome beacon
vast sapphire
tidal socket
eternal oxide
#

If it says 1 then the packet you are building seems to only support 1

chrome beacon
#

Protocollib uses a WrappedParticle instead of the first int

#

See link above

tidal socket
#

packet.getIntegers().write(0, WrappedParticle.create(Particle.DRIP_LAVA, ?));

?

chrome beacon
#

No

#

Look at the link ._.

tidal socket
#

Should I copy it in my project and create the packet?

chrome beacon
#

If you want

tidal socket
#

Ok i can try, so to use particle I can't follow wiki.vg

proud basin
#

I don’t think so anyways

manic furnace
#

When i publish a plugin, can i post a donate link on the site?

quiet ice
#

It always depends, but usually yes

manic furnace
#

Ok and can i ling my git-hub? Because you need a second program for my plugin.

#

*link

quiet ice
#

I think so? Just note that it should be able to run on spigot, so if that other program is a spigot fork then that wont work

manic furnace
#

It is a normal jar program

solid cargo
#

How can i stop custom mobs being afraid from the sun?

candid galleon
#

Fuck with their NMS

waxen plinth
onyx fjord
#

hii

#

my intellij is having problems

#

can someone compile a plugin for me?

#

(sadly no maven or gradle project)

solid cargo
worn tundra
onyx fjord
#

@solid cargoEntityCombustEvent

#

cancel it

young knoll
#

Or fire resistance

#

I think you can also put any item on their head, including something like a button which would be covered by the head model

quaint mantle
#

Hey so uhh, Ive been trying for a long time and I cant find out how to change the project java version.

waxen plinth
#

I don't know how to do it in eclipse

#

Maybe right click on the system library and there will be an option there

#

I don't know

quaint mantle
#

When I do right click on my plugin folder thing something called proberties is there

#

It might be in there

#

Theres all this stuff there:

#

Think It would be in any of those?

eternal oxide
#

Project menu -> properties -> Java Build Path -> select Libraries tab. Java system library and click edit

shadow tide
#

Hi im back and I would like to know what is wrong with my plugin.yml Invalid plugin.yml

version: 1.0
author: CJendantix
main: com.CJendantix.plugin.Plugin
api-version: 1.17
commands:
  heal:
    description: Heals and Feeds player to max.
    usage: /<command>
    aliases: feed```
shadow tide
#

wdym

lost matrix
#

Your 'error' message

shadow tide
#

Could not load 'plugins\plugin.jar' in folder 'plugins'
org.bukkit.plugin.InvalidDescriptionException: Invalid plugin.yml
at org.bukkit.plugin.java.JavaPluginLoader.getPluginDescription(JavaPluginLoader.java:170) ~[spigot.jar:3231-Spigot-3c1fc60-e167f28]
at org.bukkit.plugin.SimplePluginManager.loadPlugins(SimplePluginManager.java:144) ~[spigot.jar:3231-Spigot-3c1fc60-e167f28]
at org.bukkit.craftbukkit.v1_17_R1.CraftServer.loadPlugins(CraftServer.java:400) ~[spigot.jar:3231-Spigot-3c1fc60-e167f28]
at net.minecraft.server.dedicated.DedicatedServer.init(DedicatedServer.java:233) ~[spigot.jar:3231-Spigot-3c1fc60-e167f28]
at net.minecraft.server.MinecraftServer.x(MinecraftServer.java:1010) ~[spigot.jar:3231-Spigot-3c1fc60-e167f28]
at net.minecraft.server.MinecraftServer.lambda$0(MinecraftServer.java:305) ~[spigot.jar:3231-Spigot-3c1fc60-e167f28]
at java.lang.Thread.run(Thread.java:831) [?:?]
Caused by: java.io.FileNotFoundException: Jar does not contain plugin.yml

young knoll
#

Caused by: java.io.FileNotFoundException: Jar does not contain plugin.yml

#

What is your build tool and what folder is plugin.yml in

shadow tide
#

I'm not using gradle or maven so my build tool is eclipse and my plugin.yml is in src

young knoll
#

Should be in the root folder

shadow tide
#

ahh

#

thanks

#

now this [15:47:02] [Server thread/ERROR]: Could not load 'plugins\plugin.jar' in folder 'plugins' org.bukkit.plugin.InvalidPluginException: Cannot find main class `com.CJendantix.plugin.Plugin' at org.bukkit.plugin.java.PluginClassLoader.<init>(PluginClassLoader.java:69) ~[spigot.jar:3231-Spigot-3c1fc60-e167f28] at org.bukkit.plugin.java.JavaPluginLoader.loadPlugin(JavaPluginLoader.java:145) ~[spigot.jar:3231-Spigot-3c1fc60-e167f28] at org.bukkit.plugin.SimplePluginManager.loadPlugin(SimplePluginManager.java:394) ~[spigot.jar:3231-Spigot-3c1fc60-e167f28] at org.bukkit.plugin.SimplePluginManager.loadPlugins(SimplePluginManager.java:301) ~[spigot.jar:3231-Spigot-3c1fc60-e167f28] at org.bukkit.craftbukkit.v1_17_R1.CraftServer.loadPlugins(CraftServer.java:400) ~[spigot.jar:3231-Spigot-3c1fc60-e167f28] at net.minecraft.server.dedicated.DedicatedServer.init(DedicatedServer.java:233) ~[spigot.jar:3231-Spigot-3c1fc60-e167f28] at net.minecraft.server.MinecraftServer.x(MinecraftServer.java:1010) ~[spigot.jar:3231-Spigot-3c1fc60-e167f28] at net.minecraft.server.MinecraftServer.lambda$0(MinecraftServer.java:305) ~[spigot.jar:3231-Spigot-3c1fc60-e167f28] at java.lang.Thread.run(Thread.java:831) [?:?] Caused by: java.lang.ClassNotFoundException: com.CJendantix.plugin.Plugin at org.bukkit.plugin.java.PluginClassLoader.loadClass0(PluginClassLoader.java:142) ~[spigot.jar:3231-Spigot-3c1fc60-e167f28] at org.bukkit.plugin.java.PluginClassLoader.loadClass(PluginClassLoader.java:99) ~[spigot.jar:3231-Spigot-3c1fc60-e167f28] at java.lang.ClassLoader.loadClass(ClassLoader.java:519) ~[?:?] at java.lang.Class.forName0(Native Method) ~[?:?] at java.lang.Class.forName(Class.java:466) ~[?:?] at org.bukkit.plugin.java.PluginClassLoader.<init>(PluginClassLoader.java:67) ~[spigot.jar:3231-Spigot-3c1fc60-e167f28]

#

@young knoll

lost matrix
shadow tide
#

soo

lost matrix
#

Correct the path in your plugin.yml

shadow tide
#

wait I fix

torn oyster
#

how do i sort a list by a boolean first, then an int

#

then alphabetical

shadow tide
#

first how does this tie into spigot

torn oyster
stone sinew
torn oyster
#

sorting by if they are online

shadow tide
#

k

lost matrix
torn oyster
#

then what weight their rank is

#

then alphabetical order

graceful cargo
#

hey! i'm here to ask a question, i want to take a minecraft server's seed and find the ore locations in between a 0-10000 block location, maybe save it to a txt for later use, is this possible?

torn oyster
lost matrix
young knoll
#

Sort by A, if the result is 0 sort by B, etc etc

graceful cargo
lost matrix
torn oyster
#

i want everyone to be sorted by booean, int, then alphabetical

#

not certain ppl

graceful cargo
young knoll
#

Something like

i = sortA
if (i == 0)
i = sortB
if (i == 0)
i = sortC
return i

lost matrix
torn oyster
young knoll
#

Correct

torn oyster
#

to

#

online people above offline people

#

sorted by rank

#

and in the rank category, sorted by name

young knoll
#

mhm

#

Let me write an example

torn oyster
#

so this list

VIP JohnDoe - Offline
VIP+ IdkWhatToCallThisOne - Offline
SameGoesForThisOne - in the lobby
VIP+ Abcdefg - Offline```
#

would become

#
VIP+ Abcdefg - Offline
VIP+ IdkWhatToCallThisOne - Offline
VIP JohnDoe - Offline```
#

right?

#

sort it to that

#

how do i sort a list by

  • Online (boolean)
  • Rank Weight (int)
  • Name (alphabetical)

i wanna make it so

VIP+ IdkWhatToCallThisOne - Offline
SameGoesForThisOne - in the lobby
VIP+ Abcdefg - Offline```
would become
```SameGoesForThisOne - in the lobby
VIP+ Abcdefg - Offline
VIP+ IdkWhatToCallThisOne - Offline
VIP JohnDoe - Offline```
young knoll
#

Crappy example complete

raven ore
#

I use spigot api 1.8.8, how can i detect the hit on an EntityArmorStand by the player

lost matrix
raven ore
#

EntityDamageByEntityEvent doesn't work

young knoll
#

EntityArmorStand

unreal quartz
#

dat sux

young knoll
#

Client side I assume?

raven ore
#

yes

lost matrix
# raven ore yes

Wait so its not a physical armorstand?
Then listen for incoming packets.

raven ore
#

I send PacketPlayOutSpawnEntityLiving to my player but when he hits the armorstand nothing happend

young knoll
#

listen for incoming packets

raven ore
#

how can i do that please

quiet ice
#

ugh, NMS magic?

lost matrix
raven ore
#

thx

shadow tide
#

can someone send me to the spigot documentation (if it exists)

young knoll
#

?jd

torn oyster
#

Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.1:compile (default-compile) on project MaxicraftFriendsParties: Fatal error compiling

#

what lol

#

no other errors

#

just that

vague oracle
#

There should be more

tiny wolf
#

Any reason why my bungee configs get reformatted ?

#

and all comments removed

torn oyster
golden turret
#

not spigot related but i want to make all clock related data (hour, minute, second and millisecond) to be zero

torn oyster
#

how to convert "Color" to "ChatColor"

golden turret
#

the output:

#

as you can see, sometimes it is 12h and others is 0

dry forum
#

how would i get a list of all the configuration section? for example i had

  1: "e"
  2: "e"
test2:
  1: "e"
  2: "e"
test3:
  1: "e"
  2: "e"```
how could i get test1, test2, and test3 and store them?
golden turret
#

YamlConfiguration is a ConfigurationSection

#

so

#

config.getValues(true)

#

will return as map

vague oracle
golden turret
#

🀑

golden turret
vague oracle
#

no problem πŸ™‚

gaunt eagle
#

Can anybody give an example for using it ^^

#

i think its about hexcode

young knoll
#

Otherwise you could use a switch statement

golden turret
dry forum
#

using getValues(false) showed up as
List:{1=MemorySection[path='1', root = 'YamlConfiguration']

vague oracle
#

Im pretty sure ALL_CODES just shows you all the cords

#

codes

young knoll
#

Yes

#

I’m not really sure what exactly you’d use it for

golden turret
gaunt eagle
#

im in 1.17.1

dry forum
#

this is exactly what i put
plugin.getConfig().getValues(false)

#

no they are their own sections

golden turret
#

bc im not finding it

young knoll
#

If you are dealing with user input you may want to write some code to convert &#rrggbb instead

gaunt eagle
golden turret
#

im talking about the chatcolor class

gaunt eagle
#

ow

#

true

young knoll
#

Use the bungee one

#

Not the bukkit one

#

It has ChatColor.of

gaunt eagle
#

I don't know, it may belong to another Class, I'm just trying to learn how xd

golden turret
#

not find in the chatcolor of bukkit

dry forum
#

there is no parent, my config is the example i sent

young knoll
golden turret
gaunt eagle
#

understood, i will search, thanks for attention <2

young knoll
#

The bungee version is part of spigot

golden turret
young knoll
#

You should pretty much always use it over org.bukkit.chatcolor

golden turret
young knoll
#

You don’t even have to afaik

#

It’s part of the API, not NMS

dry forum
#

so i have 3 different sections in my config (the example i sent) and all it did was send List:{1=MemorySection[path='1', root = 'YamlConfiguration'] 3 times but for each one so instead of it being '1' it would be '2' etc

young knoll
#

Should just be getConfig().getKeys(false)

#

Returns a collection of strings iirc

dry forum
#

so replace getvalues with getkeys?

#

oh ok ty

formal dome
#

how do you get the compile method to work in a build.gradle file

golden turret
#

check the line 70

golden turret
formal dome
#

?paste

undone axleBOT
formal dome
golden turret
formal dome
dry forum
#

it worked now tysm ::))

golden turret
#

compileOnly

formal dome
young knoll
#

getValues does exist, but it returns a map of key - value

#

And that value may be a further configurationsection

golden turret
formal dome
#

which version of log4j does spigot use?

vast sapphire
#

I have a list of one hit materials and i'm trying to compare the broken block to the list and if it's equal to an object on the list then it won't create an explosion. here is my code java for (Object mat : ItemStacks.oneHItMaterials()) { if (e.getBlock() != (mat)) { p.getWorld().createExplosion(e.getBlock().getLocation(), 1); } break; }
here is my list: https://paste.md-5.net/owowosoyop.cs

vague oracle
#

my god

quaint mantle
#

Uh

quaint mantle
#

second, this should be handled with a set and #contains

#
if (materials.contains(material)) {
    p.getWorld().createExplosion(block.getLocation(), 1);
}
vast sapphire
#

thanks

formal dome
#

so is spigot in java 8?

#

i'm having issues with hikariCP being in java 11

quaint mantle
#

1.17 is java 16+

formal dome
#

ah

delicate lodge
formal dome
#

good an easy copy and paste into a java 16 project solved that issue

formal dome
delicate lodge
#

oh oops

golden turret
quaint mantle
#

i dont think that helped him

azure ravine
#

is there an alternative for Bukkit/Server#craftItem and Bukkit/server#getCraftingRecipe in the 1.16 api?

tired oar
#

Hey I am wondering how to do this. Compass Tracker how do I add it into my minecraft game or world? can someone help me?

vast sapphire
#

why are stone blocks not breaking but dirt is on the explosion? java if (p.getInventory().getItemInMainHand().isSimilar(ItemStacks.pickAxe())) { if (!ItemStacks.oneHitMaterials().contains(e.getBlock().getType())) { p.getWorld().createExplosion(e.getBlock().getLocation(), 1.9F, false, true); } }

vast sapphire
tired oar
#

The player tracker plugin. How do you add it to my world? because I never done anything with plugins before