#help-development

1 messages · Page 1809 of 1

spiral light
#

cant you use:
PacketPlayPlayOutRelEntityMove packet = new PacketPlayPlayOutRelEntityMove(id,short,short,short)

stone sinew
#

I don't waste my time on that.

eternal night
#

LMAO

spiral light
misty current
stone sinew
misty current
#

i'm just a liiittle bit on legacy

#

just a tiny bit

#

1.8 ahem

spiral light
#

i hope they change the nms methods every release for now 🙂

eternal night
#

just to make them suffer xD

spiral light
#

yes

stone sinew
misty current
ancient plank
misty current
#

what if they change either class names or field names?

spiral light
#

but if the methodname changes every version you will suffer

late sonnet
stone sinew
misty current
#

btw the only constructor i have is this one

        public PacketPlayOutRelEntityMove(int var1, byte var2, byte var3, byte var4, boolean var5) {
            super(var1);
            this.b = var2;
            this.c = var3;
            this.d = var4;
            this.g = var5;
        }
spiral light
#

cant remember that the api was more broken more then nms versions or at least broken at all

misty current
#

i guess that the int is the entityid and the bytes are the rel movement

#

but what's that boolean

spiral light
late sonnet
misty current
#

don't think it matters as long as it's a fake entity

spiral light
hybrid spoke
#

1.8 to 1.9

#

second hand came in and broke many plugins

spiral light
late sonnet
sullen marlin
misty current
sullen marlin
#

b) How would I know if you don't make bug reports

spiral light
misty current
#

lmao

quaint mantle
#

The most useful website

misty current
#

anyways how should i convert a short to the byte needed for the constructor?

stone sinew
misty current
sullen marlin
#

your method

stone sinew
slim cairn
#

@quaint mantle I know you said you wanted to rest but that was like 10 hours ago, sorry if I'm interrupting you. However nothing I tried worked and the thing you told me to look into also didnt work

spiral light
misty current
#

smh fixed point numbers

#

or whatever they call them

quaint mantle
#

fixed point? Not floating?

hybrid spoke
#

?paste

undone axleBOT
misty current
#

do i multiply my number * 32 to make it a fixed point number

slim cairn
#

So I ahve this script, however now I actually have to stand on the block

#

ah sorry

quaint mantle
#

Whats fixed point number

misty current
#

something mc protocol uses

sullen marlin
#

code looks fine (though is -1 necessary?), whats the issue?

slim cairn
# hybrid spoke whats the exact issue?

https://paste.md-5.net/opaliyuvar.java
So I have this script, however now I have to stand on said block in order to get the Light_Blue_Dye. However The thing is that players fly into rings (Yes solid rings, you dont go through them) But now if they fly against it they have to wait until they reach the botttum of the ring to actually get the Dye. How do I make it so that as soon as the player touches the Glass while for example flying into it with an elytra, the if statement still runs?

#

The person I was talking to told me to look into Interact Events however I wasnt able to figure it out

sullen marlin
#

you'd need to check all the blocks in a nearby area

hybrid spoke
#

or if you know the location of the blocks, check the distance to the players location

#

Player player = event.getPlayer(); // get the player very useful comment

tacit drift
#

is this right for a recipe? does every .recipe call refer to a line in the crafting table?

slim cairn
slim cairn
hybrid spoke
hybrid spoke
slim cairn
#

Currenctly I'm just putting a barrier of said block behind the ring since flying through them seemed almost impossible, since someone said I'd have to give every single ring a WG region then when that WG region is passed, it gives a Dye.

hybrid spoke
#

its not

#

and for what a WG region

dry forum
#

is it possible to make it so an anvil gui can support an infinite amount of characters?

hybrid spoke
#

there are many ways to accomplish this

slim cairn
hybrid spoke
slim cairn
#

so give every 700 rings a core location ah great

sullen marlin
#

well you've already hardecoded the teleport destination?

#

are all 700 rings meant to teleport to the same spot

slim cairn
#

no definitly not

#

but if you can go through them, I dont want to teleport

#

it was just so the player doesnt get stuck inside of the ring from the way I'm handling things right now.

sullen marlin
#

so you want it if you hit the edge of the ring you get teleported back?

slim cairn
#

Okay so basically. If you go through the ring, depending on the ring color you get a different amount of Light_Blue_dye. If you touch the ring ITSELF you get teleported back to spawn.

quaint mantle
#

I'd store the locs in a hashset

sullen marlin
#

ok touching the ring is relatively easily - check 0.5 block every side of the player or something

#

going through the ring is harder, but I really would suggest storing the centre of the ring somewhere

hybrid spoke
#

^blockfaces

sullen marlin
#

and then just checking if they move with X blocks of the centre

calm whale
#

Hi, I would like to know if it's possible to get map canvas from a map item whitout setting a new renderer ?

slim cairn
hybrid spoke
#

then you should start with simpler things

quaint mantle
#

I would just precalculate all locs within the Ring and push it in a set. If afterwards the Location of the Player matches one of the locs in that Set the Player has gone through it. Just don't forget to round to integers beforehand though

slim cairn
#

aka the script I have right now

quaint mantle
#

Issue is that with 700 rings this could be very memory intensive

slim cairn
#

ye my pc doesn't have a lot of memory so that's a bad idea

quaint mantle
#

But at least it has a big O of 1

slim cairn
#

my server has like 2.5gb

quaint mantle
#

I mean 10k-ish loc objects should only be a couple of megs

hybrid spoke
#

and why do you generate all at once?

#

also that will not take much memory

quaint mantle
#

So not too much of an issue given that we have absurd amounts of Mem nowadays

hybrid spoke
#

the map and your onMove spam will probably be more of an performance issue

slim cairn
#

Listen, I'd love to listen to your ideas and all. However at this moment I dont have the skills to do things like that and my computer also wouldn't be very happy about it. I also don't plan on fully learning Java as normally I don't even make my own plugins. It's just that I'm making this one myself.

quaint mantle
#

Which is why I proposed a O(1) impl

hybrid spoke
quaint mantle
#

MC is CPU bound, so Mem can be disregarded usually

#

Of course, no insane allocations should be performed

slim cairn
#

and my cpu aint even that bad

#

heck even fortnite uses less cpu

quaint mantle
#

To be honest, it is a wonder that it does not use more

young knoll
#

I'm struggling to figure out where an implementation for getDefaultAttributes would go

#

It's not really bound to ItemMeta, but I guess that is the logical place for it

#

Actually no that doesn't work, because ItemMeta does not have reference to the item itself

peak granite
#

how do u reset a player's time

#

to default

young knoll
#

"Time"?

#

Like, day/night time?

peak granite
#

no

#

reset it to the server time

#

instead of a custom number

young knoll
#

Reset what

peak granite
#

player.setPlayerTime

young knoll
#

So yes, day/night time

peak granite
#

how do i send a request to "url" then get the json details of the request

young knoll
proud basin
#

anyone know why when I run my custom jar file version of minecraft it just replaces it with a default one?

misty current
#

hi, i'm tryna learn to use streams and i was wondering, showingTo.stream().filter(OfflinePlayer::isOnline).toArray(Player[]::new) would this work to make a list of offlineplayers a list of players if the offlineplayer is online?

ivory sleet
#

Your question is confusing

#

Wym

misty current
#

my bad

#

i have a list of offlineplayers

#

i want to filter online players

#

and make an array out of them

ivory sleet
#

filter(OfflinePlayer::isOnline).map(OfflinePlayer::getPlayer).toArray(Player[]::new) then

#

But it was mostly correct

misty current
#

thanks

main nacelle
#

Helloo, can anyone help me with my tree populator? i really don't know how to use the new api to make one and there aren't a lot of guides out there on it, so I thought maybe someone here would know what's wrong with my code...

    @Override
    public void populate(@NotNull WorldInfo worldInfo, @NotNull Random random, int chunkX, int chunkZ, @NotNull LimitedRegion limitedRegion) {

        if(random.nextBoolean()){
            int amount = random.nextInt(4)+1;
            for(int i = 1; i<amount; i++){
    
                int X = chunkX*16;
                int Y = 1;
                int Z = chunkZ*16;

                for (int i = worldInfo.getMaxHeight()-1; limitedRegion.getWorld().getBlockAt(X, i, Z).getType() == Material.AIR; i--){
                    Y = i;
                }
                Location location = new Location(null, X, Y, Z);
                limitedRegion.generateTree(location, random, TreeType.CHORUS_PLANT);
            }

        }

    }
dry forum
#

is it possible to make it so an anvil gui can support an infinite amount of characters?

left swift
#

how can I set the velocity for entity so that it moves in the direction the player hit?

sullen marlin
main nacelle
#

like that warning is so common but with this it just freezes idk why,,,

sullen marlin
#

I dont think the new api should be much different to the old one for populators

#

did the old code work

main nacelle
#

not really, using the old code crashed the server and gave me an out of bounds exception

#

here's the old code if it helps at all

@Override
    public void populate(World world, Random random, Chunk chunk){

        if(random.nextBoolean()){
            int amount = random.nextInt(4)+1;
            for(int i = 1; i<amount; i++){
                int X = random.nextInt(8);
                int Z = random.nextInt(8);
                int Y = 1;
                for (int j = world.getMaxHeight()-1; chunk.getBlock(X, j, Z).getType() == Material.AIR; j--){
                    Y = j;
                }
                world.generateTree(chunk.getBlock(X, Y, Z).getLocation(), TreeType.TREE);
            }
        }

    }
sullen marlin
#
            for (int i = worldInfo.getMaxHeight()-1; limitedRegion.getWorld().getBlockAt(X, i, Z).getType() == Material.AIR; i--){
#

bit concerned youre accessing the world directly, you should avoid getWorl

#

otherwise not sure, debug your code and see whats executing

young knoll
#

Are block populators constrained to the single chunk or do they give you access to a 3x3 area like vanilla?

glossy scroll
#

in the process of upgrading reflection i got a little confused about what is remapped and what isnt

#

is everything obfuscated now? including fields and methods?

#

or is it just fields like 1.17

main nacelle
sullen marlin
#

not classes 😉

young knoll
#

Not yet

glossy scroll
#

my pr to implement what i wanted to implement went stale and i unfortuantely cant afford the time to make any PRs right now 😔

left swift
#

how can I give an entity a vector to have it kick back in the direction the player hit it

glossy scroll
# young knoll both

just confirm, there are absolutely no methods that have kept their 1.17 mappings

#

im looking through the mappings files and it doesnt seem that way, just wanna make sure someone can verify!

young knoll
left swift
young knoll
#

I believe so

dry forum
#

im trying to use https://www.spigotmc.org/resources/worldguard-events.65176/ i added the maven dependency but when i start the server i get this error failed to register events for class com.jere.regions.RegionHandler because net/raidstone/wgevents/events/RegionEnteredEvent does not exist. how can i fix this?

young knoll
#

Do you have the plugin on the server

#

And does your plugin depend on it

dry forum
#

i dont have it on my server and it is in the depend section

young knoll
#

Well

#

You kinda need it on your server

dry forum
#

ah i thought maven did that..

#

i tried it without depend before as well

late sonnet
#

(bad explanation...) You still need add the plugins what your use in your plugin in the server

dry forum
#

alright thanks

left swift
young knoll
#

Try getEyeLocation.getDirection

left swift
young knoll
#

All mobs have a getEyeLocaiton iirc

#

Projectiles don't, you could try just getLocation

left swift
#

yup, getLocation get Direction works, thx!

young knoll
#

Hey MD any guidance as to where I would implement a getDefaultAttributes method? (For items)

misty current
#

dude it took me a good hour just to figure how to show a packet armorstand properly to a player

#

i cry

quaint mantle
mighty sorrel
#

hey I am a person that is completely new to coding and I am interested in learning how to make a plugin with eclipse, can anyone here teach me the setup for it?

#

I just need to get to he point where I can make a hello plugin

dry forum
#

why can i not use
if (b = null) { b is a boolean

misty current
#

primitives can't be null

#

java 101

hybrid spoke
#

also you are trying to set the boolean to null in an if statement

dry forum
#

im trying to see if the boolean is or isnt set

ivory sleet
#

It’ll always be set

hybrid spoke
#

not if he is using the boolean wrapper

misty current
dry forum
#

im getting a boolean from the config section

dry forum
misty current
#

if you use getBoolean it returns a primitive

#

doesn't it

#

it's gonna default to false

hybrid spoke
#

so you want to check (b == null) if the boolean is null, and not set (b = null) it

dry forum
hybrid spoke
#

read again

ivory sleet
#

Anyways boolean variables cannot be null nor the return value of boolean methods

dry forum
#

so if its null itll be false?

ivory sleet
#

if not true then it’s false

#

There’s no null value for boolean

misty current
#

i sent packet wrong and armorstands went whoosh

ivory sleet
#

Same with all other primitive types

dry forum
#

even if the boolean isnt set in the config?

ivory sleet
#

You’d have to check with ::isSet

hybrid spoke
#

as he already said, he is getting the wrapper of the primitive type boolean which can of course be null

dry forum
#

ah ok thanks

hybrid spoke
#

or does the config always return a Boolean?

ivory sleet
#

::getBoolean returns boolean not Boolean, even if you were to box it it’d still not be null shrug

young knoll
#

boolean better got hands if he wants to box

hybrid spoke
misty current
#

ok so it took me 2 hours but finally, my armorstand animations are smoother than ice

dry forum
#

so if i used Boolean b = configsection.getBoolean(dir); there would be no way to check if the boolean actually exists?

young knoll
#

isSet

#

Or you can pass a default

dry forum
#

Cannot resolve symbol 'isSet'

dry forum
#

thats a config section?

young knoll
#

what?

dry forum
#

it says
Checks if this ConfigurationSection has a value set for the given path.

ivory sleet
#

if (configsection.isSet(dir)) I think you mean?

dry forum
#

yeah thanks

analog surge
#

someone explain this to me

#

[ERROR] Could not load 'plugins/0.0.3.1.25.1.snapshot.jar' in folder 'plugins'

org.bukkit.plugin.InvalidDescriptionException: commands are of wrong type

at org.bukkit.plugin.PluginDescriptionFile.loadMap(PluginDescriptionFile.java:946) ~[spigot-1.8.8.jar:git-Spigot-21fe707-e1ebe52]

at org.bukkit.plugin.PluginDescriptionFile.<init>(PluginDescriptionFile.java:232) ~[spigot-1.8.8.jar:git-Spigot-21fe707-e1ebe52]

at org.bukkit.plugin.java.JavaPluginLoader.getPluginDescription(JavaPluginLoader.java:159) ~[spigot-1.8.8.jar:git-Spigot-21fe707-e1ebe52]

at org.bukkit.plugin.SimplePluginManager.loadPlugins(SimplePluginManager.java:133) [spigot-1.8.8.jar:git-Spigot-21fe707-e1ebe52]

at org.bukkit.craftbukkit.v1_8_R3.CraftServer.loadPlugins(CraftServer.java:292) [spigot-1.8.8.jar:git-Spigot-21fe707-e1ebe52]

at org.bukkit.craftbukkit.v1_8_R3.CraftServer.reload(CraftServer.java:739) [spigot-1.8.8.jar:git-Spigot-21fe707-e1ebe52]

at org.bukkit.Bukkit.reload(Bukkit.java:535) [spigot-1.8.8.jar:git-Spigot-21fe707-e1ebe52]

ivory sleet
#

Send your plugin.yml

analog surge
#

ok

#

main: ledmans.miplugin.MiPlugin
version: '0.0.3.1.25.snapshot'
name: MiPlugin
authors: [ ledmans ]

commands:
paintball

ivory sleet
#

paintball**:**

#

note the : at the end

analog surge
#

ok

analog surge
#

I really appreciate it

quaint mantle
#

morning @ivory sleet

wooden fable
#

If I want to make an mc plugin for 1.17+ do I have to use java 16? Or can I just use java 8?

young knoll
#

You can use 8 if you don’t use any NMS

wooden fable
#

Eh what is an NMS?

young knoll
#

net.minecraft.server

lusty sinew
#

how to decompile zelix klassmaster 15

karmic grove
#

so my plugin is too big to upload to spigotmc whats good extrnal downloading site

lusty sinew
#

literally will pay for help

ember estuary
#

what are some uses for running a task asynchronously ?

tender shard
#

did you shade your whole operating system into it?

young knoll
karmic grove
young knoll
#

Like idk, a bunch of math calculations

#

That’s

#

Very big

tender shard
#

wtf why is your plugin 44mb

karmic grove
#

uh

young knoll
#

Spigot itself is like 69mb

tender shard
#

did you shade the whole server into it?

karmic grove
#

no

#

all it does is change you max health

tender shard
#

the limit on spigot is 4mb iirc

#

well then you did some very bad job

young knoll
#

Yeah you definitely shaded spigot

karmic grove
tender shard
young knoll
#

Show us the Pom

tender shard
#

then send link and we'll check what you did

young knoll
#

Or build.gradle

fast onyx
#

how i can give speed 1?, i put "amplifier 1" and gives speed 2

karmic grove
tender shard
#

yes

karmic grove
#

dms?

fast onyx
#

still 2

tender shard
#

i dont care where you send it^^

young knoll
#

Well that’s literally how you do it

#

And it always has been

fast onyx
young knoll
#

Even in the vanilla /effect

fast onyx
young knoll
#

Did you remove the old effect from yourself

#

Because it won’t override it

fast onyx
#

i did

#

let me remove all effects

#

1s

#

yes still speed 2

minor fox
#

Is PluginManager::disablePlugin(Plugin) supposed to remove the specified plugins commands from the command map?

karmic grove
#

how many kb

misty current
#

It's pretty normal

karmic grove
#

then whys mine so big

misty current
#

The api is probably 1/3rd of it

tender shard
young knoll
#

Because you’ve probably shaded something

misty current
tender shard
#

it literally contains the game server

#

no idea how you did that

karmic grove
#

how do i not do it

young knoll
#

What do you use to build

misty current
#

Everyone does that at least once lmfao

fast onyx
misty current
#

I used to too back then lol

tender shard
karmic grove
#

it still will work wont it

misty current
#

Theni figured

young knoll
#

Yes but including the entire server is illegal

misty current
#

Why lol

young knoll
#

Because it contains minecraft code?

misty current
#

Like stealing stuff from md

#

Oh right

#

It's also mc code

karmic grove
#

so how do i fix xd

misty current
#

And it's not open source

misty current
karmic grove
#

build artifacts in intellij

young knoll
#

I did not know those could shade things

karmic grove
#

do i not do this?

misty current
#

In the project structure there should be something to make it not build the jar inside it

karmic grove
#

do i not do from modules with dependicies

misty current
tender shard
#

switching to maven would probably be easier than finding out how it works in the GUI

karmic grove
#

bruh

misty current
#

Yeah use either maven or gradle

#

They exist for a reason

karmic grove
#

well my plugin will still work right

misty current
#

Yeah ofc

young knoll
#

You just can’t upload it anywhere

misty current
#

Maven just helps you manage dependencies

#

Along with gradle

karmic grove
#

it re puts server files in the plugins folder

#

help

misty current
#

Then you should probably go to the right one and wait

young knoll
#

If you don’t want to use maven or grade then you should google how to properly build a plugin with IntelliJ

#

I’m sure someone else has had the same issue

karmic grove
#

can you add gradle to intellij or somthing

young knoll
#

Yes

karmic grove
#

so gradle will fix my issue

tender shard
#

right click project -> Add Framework support

#

you will definitely have to learn on how to use it though

ivory sleet
#

Hmm Idk what it really does to commands

#

But my assumption would be that

young knoll
#

Easiest way is to find out

minor fox
#

I notice some strange behaviour when I try to use a disabled plugins commands

#

World edit spits out errors, while other plugins don't do anything

ivory sleet
#

Hmm probably depends on how they were disabled?

tender shard
#

It doesn't unregister any commands

young knoll
#

That would explain the errors people often have here

#

SomethingException: plugin is disabled

minor fox
#

Wouldn't it make sense to remove a plugins commands too?

tender shard
#

this is the whole disablePlugin method from JavaPluginLoader

young knoll
#

Maybe

tender shard
young knoll
#

I mean

#

Arguable

minor fox
#

My plugin requires some plugins to be disabled on startup if they are detected

young knoll
#

Sus

tender shard
#

why?

misty current
minor fox
#

Because I have certain servers that don't need them

young knoll
#

Then uninstall them?

minor fox
#

Not so easy sir, I use docker images

misty current
#

You could remove them from the commandmap somehow i suppose but not sure

tender shard
#

writing a plugin to disable other plugins instead of just uninstalling them is very strange lol

young knoll
#

Well, you could delete them and disable them

ivory sleet
young knoll
#

And then force a restart

#

I guess

minor fox
#

I literally can't uninstall them

#

I need to do it dynamically

misty current
#

Why can't you

minor fox
#

Because as I said, I use a docker image

young knoll
ivory sleet
misty current
#

Well that's a reason to why reloads are bad

#

One of many

young knoll
#

Reloads were meant to be supported

tender shard
young knoll
#

Plugins just... didn’t

ivory sleet
#

Well reloads are probably fine-ish

#

As the entire server gets swallowed by gc

#

Almost

young knoll
#

Really?

#

Lul

ivory sleet
#

Yeah sorta

minor fox
misty current
#

Well if you make your plugin instance null on reload

young knoll
#

Well then write the PR for it

ivory sleet
#

All it requires is for plugins to implement onDisable like any decent spigot plugin 🤡

misty current
#

Your entire pl should be eaten by gc

#

Shouldnt it

tender shard
#

the CommandMap interface doesnt even have a unregister method

ivory sleet
#

An instance cannot be null

#

Only variables can be null

#

But if the instance isn’t hard-referenced it may be enqueued for gc

young knoll
#

Well I don’t think any plugin has ever done that in onDisable

tender shard
#

also the SImpleCommandMap doesnt have any unregister method

young knoll
misty current
#

Yea but if i make my code not reference to it anymore, it would be garbage collected

#

Right?

young knoll
#

Yes

ivory sleet
#

Unsure

tender shard
#

but it has a final protected field Map<String, Command> knownCommands

young knoll
#

I think

misty current
#

Unless bukkit sti references to my plugin

#

Still*

tender shard
#

so just get it with reflection and remove the entries you want gone

minor fox
#

I am already disabling some default commands using reflection, so I guess I could add more commands there

ivory sleet
#

If the spigot api implementation is done erroneously a side effect would be that your old plugin objects might still be floating around

young knoll
#

I mean I still think the map should be exposed

#

But MD disagrees

ivory sleet
#

Not proper api

misty current
#

Yeah commandmap is not really api

ivory sleet
#

Though I personally think its proper

young knoll
#

It would be if you made a proper API around it :p

ivory sleet
#

Just a bit too dangerous to expose

misty current
#

You should not touch it

#

But it's very useful

ivory sleet
#

All the noobs would go around doing all sort of crazy stuff with it

young knoll
#

I mean what’s the worst that could happen if you expose it safely

misty current
#

Well as long as reflection exists im fine with it

ivory sleet
minor fox
#

But is there an actual reason why the PluginManager won't remove the mapped commands or is it just random

young knoll
#

I mean I assume it was just overlooked

#

Who knows

misty current
#

Once a command is created it doesn't go away that easily

ivory sleet
#

Ferskfisk I don’t think ::disablePlugin was ever implemented with proper care

ancient plank
#

hmming champ

young knoll
#

Quick who do we blame for disablePlugin :p

ivory sleet
misty current
ivory sleet
#

Plugm-…

#

Average server own-…

misty current
#

;-;

ancient plank
#

me

misty current
#

Another use case is making annoying plugins with hidden code that randomly disable one of your plugin and you can't tell

#

That would be fun to code

#

:p

young knoll
#

Git blame says Jan Polak, but that was only because of nullability annotations

#

So it probably goes back to dinnerbone

minor fox
#

I don't see how you can handle onDisable properly to avoid having issues with ::disablePlugin

young knoll
#

Reflect into the map and remove your commands

#

And yes that is silly but that’s one way to do it

minor fox
#

That's what I do with a bunch of other commands right now

misty current
#

I blame oracle for not making gc read your mind

young knoll
#

Gotta use a flag for that

#

—UseTelepathicGC iirc

minor fox
#

Is there even a unregister command method in spigot

young knoll
#

No

#

There isn’t a register one either

minor fox
#

well technically

young knoll
#

Not an accessible one

minor fox
#

Oh

#

Yeah I've been working on a command manager that exposes some of that stuff

#

Makes me confused sometimes

proud basin
#

Anyone else having an issue im pulling im code but it doesn't seem to be pulling it

#

like no files are being added

quasi patrol
#

I’m not home rn so I can’t test but I wanna make plans: does hasPermission() work on the OfflinePlayer variable type?

young knoll
#

No

dry forum
#

does PlayerCommandPreprocessEvent send the command without the "/" like if i did /test or "/test"

young knoll
#

Try it?

ancient plank
#

and see?

young knoll
#

Mayhaps

proud basin
#

?tryandsee

wooden fable
#

I have a custom config file, i want to set default values with comments. How can i do that?

young knoll
#

I usually create a default in my plugin jar and then just save it to the plugin folder

#

Since any other write operations remove comments

wooden fable
#

I'm confused, do i need to make an file in my IDE with the default content?

young knoll
#

That’s what I do

wooden fable
#

But how to create an configuration variable with that file?

young knoll
#

YamlConfiguration.loadConfiguration

wooden fable
#

So the default file is visible / editable for users?

young knoll
#

If you save it to your plugin folder with Plugin.saveResource

wooden fable
#

thx for the help

proud basin
#

Is it possible to detect what minecraft client someone is using? lunar, badlion etc...

quaint mantle
#

yeah?

#

if the client send a packet

#

or something relate to channel

#

then the server will listen to that and know what is the client

#

but if they dont

#

you have no way

#

the example would be the hacked server plugin

young knoll
#

I know badlion does because you can disable modules from the server side

quaint mantle
#

lunar too

young knoll
#

There ya go

#

So does forge itself

proud basin
#

Do you know how you can send a packet?

quaint mantle
#

you can see how hacked server plugin work

#

to know how they detect client

young knoll
#

You want to send something to the server?

proud basin
#

yea

young knoll
#

Hmm

#

Unfortunately I’ve only done it the other way around, but it should work similar

#

You can receive them using messaging channels

proud basin
#

what

quaint mantle
#

i think this would be a mass gg

GGGGGG
GGGG12123124124

GGG3@!)_#@!+{}{{{!++++````
flint crown
#

hi, before you help (if you want to help) please keep in mind:

  • I am insufferably stupid

ok so anyway, I am trying to use plugin.getConfig() inside one of my commands as I want to have a config file for my plugin. However, plugin itself is not defined, so I used Plugin plugin = null;. I am not sure if this would work though, and I think my logic is off. There are no errors, but for some reason making it null doesn't make sense to me. Any help is appreciated

quaint mantle
#

I am insufferably stupid

flint crown
#

yes

#

just thought i should mention that

quaint mantle
#

No, I mean I AM

flint crown
#

because you might get frustrated with me

#

so just putting it out there

#

ah

#

so you don't know how to help me lol

proud basin
#

hm

young knoll
quaint mantle
#

?constructor

young knoll
#

Or you need a static get method in your main class

#

?di

undone axleBOT
proud basin
#

I don't think its the same col

quaint mantle
#

cool

flint crown
young knoll
#

No

flint crown
#

ok

young knoll
#

Like I said

flint crown
#

neverminD

young knoll
#

You need the instance of your main class

#

Read the DI guide

flint crown
#

will do

#

oh

#

i just split it up

#

this is possible in CommandExecutor right?

young knoll
#

It’s possible in whatever class you want

ancient plank
#

Java moment

flint crown
#

so by putting private Plugin plugin; inside the class but outside of the onCommand boolean, then I can do plugin.getConfig()

#

idk if that's explained well, but I think i did something right cause code looks ok

young knoll
#

As long as you initialize it via the constructor

mossy blaze
#

Hey! I have an error on my server that says there are "Too many files open". After that, the server crashes and the world corrupts. How do I prevent this?

wicked lake
#

Does it happen during startup?

mossy blaze
#

no, it happens a few hours into runtime

wicked lake
#

Sounds like an event is opening a file and not closing it. Make sure whatever events you have opening files close them after they're done being used

young knoll
#

I did not know that was a thing that could happen

quaint mantle
#

definitely something keeping files open

young knoll
#

The error Java IOException “Too many open files” can happen on high-load servers and it means that a process has opened too many files (file descriptors) and cannot open new ones. In Linux, the maximum open file limits are set by default for each process or user and the defaut values are quite small.

#

No idea what quite small is defined as

quaint mantle
#

usually like 1k? i think

young knoll
#

Or how many files mc itself keeps open

quaint mantle
#

netty will also open files usually for connections

sullen marlin
#

Can also mean too many threads

#

Really need to check the full error

mossy blaze
wicked lake
#

itswagpvp appears to be the offending plugin

sullen marlin
#

You're not running spigot

#

Also this is a development channel

quaint mantle
#

i like the random errors not related to open files

wicked lake
#

I feel like a lot of this log file should be put into a debug file instead but eh. Not spigot so

ocean spruce
#

Hello, so I'm new to Spigot and new to OOP but I've been a web developer for years so not new to programming, I have a quick question about handling special blocks in world, for example a block that breaks the block next to it every x seconds my first thought is to store cords in a List and save it to a file load in on restart check if block is at cords then execute. but I'm wondering if anyone has a better approach. like I said I'm not familiar with spigot.

young knoll
#

Yeah that’s a fairly standard approach

#

A database may be better

flat perch
#

Is there any way of getting the MSPT of the server? I know you can calculate it or get it through Paper, but is there any method through spigot?

ocean spruce
#

maybe ```java
Bukkit.getPluginCommand("command");

#

ah noted, I just found an example and I was just double checking the docs quick to make sure it wasn't deprecated or anything and I noticed that too

#

have a good one 😄

ocean spruce
ocean spruce
junior briar
#

does the api provides custom player data storage things?

buoyant viper
#

theres uh

#

PersistentDataContainer

#

maybe thats what u need?

proud basin
#
@Inject(method = "handleJoinGame", at = @At("RETURN"))
    private void handleJoinGame(C17PacketCustomPayload packetIn, CallbackInfo ci) {
        this.netManager.sendPacket(new C17PacketCustomPayload("MC|Brand", (new PacketBuffer(Unpooled.buffer())).writeString("poop")));
    }
``` I get an NoClassDefFoundError at NetHandlerPlayClient
#

im trying to replace the brand

lavish hemlock
#

mmmmm mixins

proud basin
#

yeah beauty

lavish hemlock
#

why not just target the string literal?

#

or... is that not possible?

proud basin
#

Not possible I'd have to inject

#

That would be illegal if I did that I believe

buoyant viper
#

NetHandlerPlayClient, isnt that an old-ish mapping

#

or is this for Forge

proud basin
#

1.8.9

buoyant viper
#

ah

#

also i think ur code would just be sending 2 payload packets no?

proud basin
#

yeah

#

that what it seems

buoyant viper
#

as long as ur aware, not sure if thats intentional or not

ocean spruce
proud basin
#

It won't let me even join a server if I send 2

#

actually

buoyant viper
#

that part sounds a little more unintentional

proud basin
#

oh def

#

I was just doing it off the top of my head

#

Because I got no clue how I could do it

buoyant viper
#

do what

#

overwrite/modify the payload packet?

proud basin
#

Im just trying to change the brand

buoyant viper
#

maybe somethings not remapping correctly

#

mixins and forge is not fun whatsoever

proud basin
#

mhm

proud basin
#
@InvokeEvent
    public void joinHypixel(ServerJoinEvent event) {
        Multithreading.runAsync(() -> {
            NetHandlerPlayClient netHandler = Minecraft.getMinecraft().getNetHandler();
            if (netHandler != null) {
                netHandler.addToSendQueue(
                    new C17PacketCustomPayload("hyperium",
                        new PacketBuffer(Unpooled.buffer()).writeString(new JsonHolder()
                            .put("id", Metadata.getModid())
                            .put("optifine", HyperiumTweaker.INSTANCE.isUsingOptifine())
                            .put("version", Metadata.getVersion()).toString())));
            }
        });
    }
buoyant viper
#

now we just gotta see where that gets called

proud basin
#

doesn't look like it gets called

quaint mantle
#

hmm i wonder what will you guys name it if we have two same object required for a method?

proud basin
quaint mantle
#
    this.whoSet = HereIsWhatIamTalkingAbout;
    player.getHandle().setMonke(-1);
}```
junior briar
sullen marlin
#

what do you mean

karmic grove
#

is there easy way to upload the source code of my plugin to github

#

in intellij

wicked lake
#

I'm sure there's git plugins as there are in Pycharm

#

But barring that you can just get github desktop

young knoll
#

Most notably with primitives

solemn igloo
#

@quaint mantle

#
[13:11:44 INFO]: [GravityAroundThePizza] Enabling GravityAroundThePizza v420.69
[13:11:44 ERROR]: Error occurred while enabling GravityAroundThePizza v420.69 (Is it up to date?)
java.lang.Error: Unresolved compilation problems: 
    String literal is not properly closed by a double-quote
    Syntax error on token "else", invalid RecordHeaderPart
    Syntax error on token ".", @ expected after this token
    Syntax error on token "UMA", ) expected
    UMA cannot be resolved to a type
    Syntax error on token ""!"", ( expected
    Syntax error on token "}", { expected
quaint mantle
#

ill help u when im free if its not solved

solemn igloo
#

oh

#

also when i type my command in console

#

it says /<gravityaroundthepizza>

#

@quaint mantle it should say WHY U IN CONSOLE U MUST BE IN GAME

young knoll
#

You have compilation errors

#

Your IDE should be yelling at you

solemn igloo
#

what

#

how do i fix it

young knoll
#

Look for the all the red markings

solemn igloo
#

umm

#

theres al,ot

young knoll
#

Well you’re going to have to address those

#

They aren’t suggestions

solemn igloo
#

wdy

#

wdym

young knoll
#

You cannot ignore them

#

Or the plugin will not work

solemn igloo
#

is it easy to fix

young knoll
#

Idk, I can’t see them

solemn igloo
#

ok wait i ss

sullen marlin
#

dude

#

we've told you how many times to learn java

#

don't come back till you do

last ledge
stone sinew
# solemn igloo

Make sure you close all your opening brackets.
Make sure you're depending on the spigot api or jar (If using 1.18 you unfortunately require maven, I think gradle might work too.)
Once done check for further errors.

quaint mantle
quaint mantle
solemn igloo
#

ok

last ledge
quaint mantle
last ledge
#

#general

#

ping me in general

solemn igloo
# quaint mantle show us ur whole code bruvva
package me.Jaden.GravityProject.commands;

import me.Jaden.GravityProject.Main;

import javax.tools.DocumentationTool.Location;

import org.bukkit.Bukkit;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;

public class HelloCommand implements CommandExecutor {
    
    @SuppressWarnings("unused")
    private Main plugin;
    
    public HelloCommand(Main plugin){
        this.plugin = plugin;
        plugin.getCommand("gravityaroundthepizza").setExecutor(this);
    }
    
    @Override
    public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
        if (cmd.getName().equalsIgnoreCase("gravityaroundthepizza")) { // If the player typed /gravityaroundthepizza then do the following, note: If you only registered this executor for one command, you don't need this
            if (!(sender instanceof Player)){
                sender.sendMessage("WHY U IN CONSOLE U MUST BE IN GAME");
                return true;
    }
        Location loc = new Location(world, 821, 32, 917);
    Bukkit.getOnlinePlayers().forEach(p -> p.teleport(loc));
            return true;
        } //If this has happened the function will return true. 
            // If this hasn't happened the value of false will be returned.
        return true; 
    }
        } else{
            p.sendmessage ("Ur not good boi be good boi and u have perms!");
 
            
        }
        return false;
    }

}
    
#

feel free to laugh at me for not good at coding

quaint mantle
#

im on my phone idk i cant really tell

buoyant viper
#

wrong Location class imported

sullen marlin
#

correct, you're more than not good

#

you can't code at all

#

?learnjava

undone axleBOT
quaint mantle
#

hey md5

#

i have a question

solemn igloo
#

ok ;-;

quaint mantle
#

with the 1.18 nms, if i try to make a class extend EntityVillager

EntityInsentient shares a method called x() with the Entity class

quaint mantle
#

which makes compilation impossible

sullen marlin
#

please see the release notes

quaint mantle
#

ok ill check

buoyant viper
sullen marlin
#

mojang mappings is the word you are looking for

last ledge
#

🎅

buoyant viper
quaint mantle
young knoll
#

That’s what the remapper is for

solemn igloo
#

Time to restart

quaint mantle
#

player, player2?

young knoll
#

Something descriptive generally

#

For example


public EntityDamageByEntityEvent(@NotNull final Entity damager, @NotNull final Entity damagee, @NotNull final DamageCause cause, final double damage)
quaint mantle
#

damagee?

#

lol?

young knoll
#

Damagee is a word

#

Kind of

#

“ee is attached to verbs that take an object to form nouns with the meaning "the person who is the object of the action of the verb'':
address + -ee → addressee”

stone sinew
# solemn igloo ``` package me.Jaden.GravityProject.commands; import me.Jaden.GravityProject.Ma...
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
    // Checks if command is the one you want
    if (cmd.getName().equalsIgnoreCase("gravityaroundthepizza")) {
        // Checks if sender is instance of player
        if(!(sender instanceof Player)) {
            // Outputs to sender that command must be ran in game
            plugin.getLogger().warning("Command must be ran in game.");
            // Returning true here stops the code from continuing.
            return true;
        }
        
        // Casts sender as player
        Player player = (Player) sender;
        
        // Checks if player has permission to preform command
        if(player.hasPermission("teleport.perm.node")) {
            // Loops through online players and teleports them to the player that preformed the command
            Bukkit.getOnlinePlayers().forEach(online -> online.teleport(player.getLocation()));
        }else {
            // Sends message to player if they do not have permission
            player.sendMessage("You do not have permission for this command.");
        }
        return true;
    }
    return false;
}
quaint mantle
#

i put again because i have no idea what to name😂

junior briar
iron tundra
#
 public void onEnable() {
        // Plugin startup logic
        this.chunks = new HashMap<>();
        getCommand("claim").setExecutor(new ClaimCommand(this));
        getServer().getPluginManager().registerEvents(new PreventionListener(this), this);
    }

Error:java.lang.NullPointerException: Cannot invoke "org.bukkit.command.PluginCommand.setExecutor(org.bukkit.command.CommandExecutor)" because the return value of "me.ispeakweeb.landclaiming.LandClaiming.getCommand(String)" is null at me.ispeakweeb.landclaiming.LandClaiming.onEnable(LandClaiming.java:16) ~[LandClaimPlugin.jar:?]

#

Also gives the error of [23:40:02 ERROR]: Error occurred while enabling LandClaiming v1.0 (Is it up to date?)

#

bruh nevermind I set up my yml wrong

summer scroll
torn shuttle
#

I remember when md_5 used to tell me I was more than not good

#

he still does, but I also remember when he used to say it back then

long river
#

is it possible to make this editable?

vague oracle
#

If you want to make a custom jar

long river
#

yes

young knoll
#

Why do you want to mess with onEnable

long river
#

no i just took that ss im not messing with it

#

i just tried to type smthng took ss and sent here

#

lol

#

so is it possible to edit it

young knoll
#

I mean

#

Is that in a plugin or is that in the server jar

long river
#

Plugin

young knoll
#

You could decompile the plugin, edit it, and then ecompile

long river
#

I decompiled it with intelij but it says that

young knoll
#

No idea if IntelliJ lets you edit stuff

#

I’ve used other tools that just spit out all the .java files, which you could easily edit

long river
#

What tools?

tardy delta
iron tundra
sacred mountain
#

is anyone free rn and could help make a plugin for me

#

its a pretty simple concept but i cant find anything online

tardy delta
#

we can help

sacred mountain
tardy delta
#

what are you trying to do?

sacred mountain
#

i know like the basics and simpel commands but the one im tryna make is slightly beyond my knowledge lol

sacred mountain
#

i can send a detailed one in dm

#

its almost a text wall so i dont wanna send it here

tardy delta
#

i guess that would mean if a player dies, he gets effects

sacred mountain
#

i wrote it up a while ago

sacred mountain
#

you can choose the particle effects or effects when you kill a player such as

you kill someoene and
lightning bolt strikes
red particles
you get strength I

tardy delta
#

and not that difficult

sacred mountain
#

like this

#

but for

#

1.8

tardy delta
#

only the maths for the particles :kekw:

sacred mountain
#

because mt server is 1.8 and thats the problem

#

and i dont think that plugin runs on 1.8 because particles were updated im pretty sure

#

gimme a sec i think i found smn

sacred mountain
#

yeah so something like that would be cool except i think the hard partn is making all those effects

#

plus that plugin doesnt have options to buy effects and permissions to buy/use

#

like killeffects.buy.<name> and killeffects.use.<name>

tardy delta
#
@EventHandler
public void onKill(PlayerDeathEvent event) {
  if (!(event.getKiller() instanceof Player)) return;
  Player killer = (Player) event.getKiller();
  // spawn lightning
  
  // spawn particles
  killer.getLocation().getWorld().spawnParticle(Particle.SPAWNER, ...);
// potion effect
  killer.addPotionEffect(new PotionEffect(PotionEffectType.STRENGTH, 100 /*5 sec*/, 1));```
}
#

something liek this

sacred mountain
#

no like

#

the player that gets killed

#

dies with the killers chosen effects

sacred mountain
tardy delta
#

ah

#

store the effect against an player uuid somewhere in a map

#

or i would even store it in the player's persistent data container but thats just me

sacred mountain
#

yeah

#

but i cant do that

tardy delta
#

1.8 go to the shame corner

sacred mountain
#

is pvp version

#

1.9 ruined everything

quaint mantle
#

hello.
if i spawn an entity with packets, and move like 100 blocks and come back, the entity is not there it despawns

#

what should i do

crimson terrace
#

may just be in 1.17 tho

sharp kelp
#

Uhm which event is used for checking the movement of player on a lama

#

PlayerMoveEvent I think is likely not as its of a player and not a lama the player is sitting on?

frosty geyser
#

off the top of my head i would say use a PlayerMoveEvent then just check if they are riding something and if they are check if they are riding a llama

#

but i could be wrong

#

Quick Questions is there any way to see what exactly changed for stuff relating to Custom Enchants from 1.8.9 to 1.12.2? because i was updating my code for 1.12.2 and now a ton relating to the enchants are now broken

sharp kelp
#

The last location and the new location on moving

#

though that

#

I need the

#

Keys pressed

#

Like is there a event to check which key the player pressed

#

Like I need WASD

#

which I thought player move event would give but not when the player is on a lama

frosty geyser
#

i don't think so since key press is client side

sharp kelp
#

I need to check for those pressed keys and then override the movements with my custom one

sharp kelp
frosty geyser
#

while plugins can only retrieve server side stuff, like player data or packets

sharp kelp
#

so In events like Player move event we should be able to get that

frosty geyser
#

so no

#

the most the server can see is if they move

#

not which key was pressed to move

fallow merlin
#

How does world edit do the bottom right one?

onyx shale
#

Well pretty self explanatory

#

Not sure if the formula inside that image is the right one tho

fallow merlin
#

That formula does generate that trunk

#

I've tried it in game

onyx shale
#

So you have your answer...?

sharp kelp
fallow merlin
#

Yea actually wasn't really sure where I was going with that lol

frosty geyser
kindred valley
#

!print

#

Someone command this

#

Pls

frosty geyser
#

it would be like player.getLocation().getDirection()

kindred valley
#

What was that command

sharp kelp
kindred valley
#

!prnt

sharp kelp
#

or walking direction

kindred valley
#

!p

#

!paste

sharp kelp
#

@frosty geyser I just cant find way to get player movement while the player is sitting on a lama, basically the lama movement

#

Is there like a entity move event

#

hmm lemme check

kindred valley
#

?paste

undone axleBOT
sharp kelp
#

I could add custom tag to the lamma and then check for the InstanceOf that lama

frosty geyser
#

you could do like if(player.getVehicle() instanceof Llama)

sharp kelp
#

yes I know that much

vague mason
#

How good is getOfflinePlayer in storing UUIDS?

#

or should my plugin store them when player joins for the first time?

coral bobcat
#

game mechanic question: When i set fire in a dark forest, it doesn't spread infinitely, despite abundant flammable material, but only to a certain radius around the initial fire, 20 blocks or something. What game mechanic is responsible for that, do encouragement and flammability get lower for blocks lit by fire spread?

spiral light
spiral light
vague mason
#

I was storing uuids of players to yaml / database.

#

But now I have switched to getOfflinePlayer

hybrid spoke
#

okay, and? whats the problem?

#

you wont even need the OfflinePlayer if you just want to send the cryptos

#

maybe for the name

hybrid spoke
vague mason
#

while UUIDs stay the same.

hybrid spoke
#

i dont get the problem. you are already storing the UUID or not?

vague mason
#

Yes

#

Previously I was storing player: uuid to every player that has joined the server in players.yml file

#

Now I have switched to getOfflinePlayer

#

Was this good decision?

hybrid spoke
#

whats the point with getOfflinePlayer? you are getting the offline player of the player with the uuid x. and now what?

daring sierra
#

oioioi wass goin on ehre lads

hybrid spoke
#

or do you mean you switched to storing names?

eternal oxide
#

No point, getOfflinePlayers returns every player that has ever been on your server

vague mason
#

previously I was storing them in a file when someone joins the server

hybrid spoke
#

ahhhhhhhhhhhhh

coral bobcat
vague mason
#

getOfflinePlayers even returns players that never joined your mc server before.

#

but mc server like freeze a little bit

hybrid spoke
#

getOfflinePlayers returns the players from your playerdata file

coral bobcat
#

that would be every player ever? makes no sense

hybrid spoke
#

imagine

vague mason
eternal oxide
#

getOfflinePlayer can get a player that has never joined. getOfflinePlayers gets ONLY those who have joined

vague mason
#

let me show you

hybrid spoke
#

maybe if you copy a world into your server, there can be OfflinePlayers which never joined before

solemn igloo
#

?paste

undone axleBOT
hybrid spoke
#

but other than that there will no players just appear

vague mason
eternal oxide
#

You are confusing getOfflinePlayer and getOfflinePlayers

#

getOfflinePlayers() returns a Collection of players who actually have data on yoru server, and no more.

hybrid spoke
# vague mason

this seems like a you problem. you are probably getting those players over the name which will load the UUID from mojang

pastel stag
#

ok i've been playing around with EntityExplodeEvent and i can't seem to figure out how to use .blockList() to print the effected blocks to an ArrayList, anyone know how to do that properly?

vague mason
#

But how much does this impact server performance?

hybrid spoke
#

as long as you dont spam it 2000 times per second, none. i mean, more than getting it by the uuid, because you request the data from mojang, but other than that, it doesnt.

vague mason
#

okay thanks.

hybrid spoke
#

but there can be edge cases

#

so it can be // This is potentially blocking :(, like the source says

eternal oxide
#

bad internet and 10 second lag on each lookup woudl be bad

#

You are also rate limited by Mojang on lookups

hybrid spoke
eternal oxide
#

I believe its a 24 hour cap

hybrid spoke
#

ok well 1000 per second or even per tick is a bit exaggerated

#

but yeah, or what happens if mojang is down f.e.

pastel stag
#

ok i've been playing around with EntityExplodeEvent and i can't seem to figure out how to use .blockList() to print the effected blocks to an ArrayList, anyone know how to do that properly?

eternal oxide
#

what are you trying to do with the list?

pastel stag
#

im going to take the list and run each set of block coordinates through an sql database and cross-check them with existing info in there

eternal oxide
#

thats going to be slow

chrome beacon
#

^

pastel stag
#

so is there a better way of doing the same thing with the affected blocks?

eternal oxide
#

well, what exactly are you trying to do?

pastel stag
#

Block protection plugin, logs protected block coordinates into a database

#

anytime a block is broken the block coordinates are query'd in the database if they are found they are deleted if they are not found, nothing happens on the database side

eternal oxide
#

ok, then if you are nto keeping all protection data in memory, load the data on chunk load

#

data being memory resident if the chunk is loaded will be much simpler adn faster to check

#

are you doing individual block protection or areas?

pastel stag
#

individual

eternal oxide
#

then load your protection data on chunk load

#

then you can do a simple .contains check

pastel stag
#

so what do i do with the blockList() data from the ExplodeEvent

#

thats the part im tricked up on

eternal oxide
#

what specifically are you protecting? a block type, a block location?

pastel stag
#

the location

eternal oxide
#

then get teh block location from teh Block and see if its being protected

pastel stag
#

so ill need the event to produce a set of coordinates for each protected block

eternal oxide
#

blockList returns an ArrayList

#

so loop the returned List and block.getLocation

pastel stag
#

ok so blockList is already an arraylist so no need to stick it in one

eternal oxide
#

check if the location is protected

#

if it is, remove it from the blockList

quaint mantle
#

isnt that plugin died?

#

and this isnt help server bro

#

this is dev channel

pastel stag
#

@eternal oxide so the part that is troubling me is using the data inside the BlockList itself, the only thing i have ever used arraylists for in the past is doing like .contains("string") for toggles

wild reef
#

Hey quick question. There is no way to open the chatbox right?

chrome beacon
#

You can't open it server side

wild reef
#

okay thank you

eternal oxide
pastel stag
#
        try {
            PreparedStatement ps3 = plugin.SQL.getConnection().prepareStatement("SELECT * FROM wb_blocks WHERE WORLD=? and X=? and Y=? and Z=?");
            ps3.setString(1, world);
            ps3.setInt(2, blockx);
            ps3.setInt(3, blocky);
            ps3.setInt(4, blockz);
            ResultSet results1 = ps3.executeQuery();
            if(results1.next()) {
                return true;
            }
            return false;
        } catch (SQLException e) {
            e.printStackTrace();
        }
        return false;```
#

this is the method i created to check if a block exists in the database ie; is protected

worn tundra
#

Couldn't that be simllified?

eternal oxide
#

You need to store/load your protection data on chunk load

#

live checking will not work

pastel stag
#

is there a reason why it wont work live? im not using the data to decide if the blocks will actually be removed or not, they will be deleted in game regardless of whether they exist, they just need to be removed from the database if they exist there

eternal oxide
#

um, that makes no sense. I thought this was a protection plugin?

#

a protection plugin is supposed to protect things

pastel stag
#

its function is to protect OTHER players from breaking the protected blocks

#

not protect them from npc's

eternal oxide
#

players are entities

#

explosions come from TNT etc

#

if you are simply going to remove teh protection if its blow up with TNT, then foreach over teh blockList, check if it exists in yoru sql and remove it

pastel stag
#

well i was planning to cross-check the entity in the EntityExplodeEvent to see what the entity is

#

for the purpose right now i'm only wanting this method im creating to look at creeper explosions

eternal oxide
#

if you are actually checking protections, then you can;t do that live

#

each sql query could take seconds to execute, It could be upto 10 seconds delay on each lookup

#

You are running everything single threaded so you will be locking yoru server up every time you perform an sql query to ask if the block can be broken

#

a single player breaking blocks is going to bring your server to its knees

pastel stag
#

i mean i have not run into any kind of issues with what you are describing yet with up to 10ish people online doing stuff all at once

#

maybe this is more of an issue when running an sql server that isnt local and on the same machine as the server?

eternal oxide
#

You will be suffering serious lag querying an sql for every block. They may not be immediately noticable on teh client, but yoru server performace will be in the bin

#

from what you have shown you are performing an sql query on every single block thats broken

tidal ether
#

Method invocation 'setType' may produce 'NullPointerException'
why does this happen?

#

@ivory sleet

ivory sleet
#

Yeah you can suffer a lot from doing IO operations or database calls without proper execution coordination

#

Because your variable is null

chrome beacon
#

Or just can be

ivory sleet
#

Yeah

#

Olivo check DMs 👀

chrome beacon
#

I did

ivory sleet
#

What you think?

tidal ether
#

yeah no it is definitely hitting the grass block

pastel stag
#

@eternal oxide that would be correct thats how the plugin currently works anyways

tidal ether
#

There shouldn't be null

ivory sleet
#

Well if whatever you use indicates nullability then it could be null

pastel stag
#

@eternal oxide this is the first plugin ive ever created in all honesty and i didnt and still dont know how to pull sets of data from a database into ram and flush them back to database whenever they need to be flushed thats way more advanced stuff then what i know how to do

ivory sleet
#

Yeah have you worked with multithread-ify your data model?

#

Else you might wanna learn a bit about concurrency and multithreading.

pastel stag
#

something tells me learning and implementing that now would require an entire redesign of my entire plugin

eternal oxide
#

probably

pastel stag
#

which at least for now im not going to do because im not running into any performance hits what-so-ever

ivory sleet
#

Probably not n0 grief

eternal oxide
#

Basically, your server needs to already have the protection data for a block break before the block is broken

wild reef
#

Hey, is there a way to block any kind of Player related Event besides a specific one?
I want a player to only be able to chat, not move, not open inv and so on.
I am just looking for some event which is like the root of every player event and check if the event is not an AsyncChatEvent

ivory sleet
#

With the assumption that you’ve just created a normal data model, it should already follow something called the humble object idea, so in principle you could wrap your existing things 🙌

pastel stag
#

possibly

#

my data structure in the database is fairly simplistic

ivory sleet
slim spire
#

Hi, can anyone tell me if it is safe to use paper spigot 1.18?

ivory sleet
#

Ask them

pastel stag
wild reef
#

that's gonna be alot xd

ivory sleet
#

Yeah I can tell damn, I mean you could theoretically at runtime find every loaded class which has a HandlerList and derives PlayerEvent

wild reef
#

hm I will look arround for something

pastel stag
#

@ivory sleet at first glance does that dataset look like its formatted in a way that would work w/ what you are suggesting

ivory sleet
#

Surely it works

#

Trying to find a good link for how to structure data in a relational database 1 sec

patent bloom
#

Can anyone walk me through exporting a .jar file? i swear i've done it before but i think i forgot a few steps lol

ivory sleet
ivory sleet
#

maybe rotate?

#

What IDE do you use imnotdani?

patent bloom
#

IntelliJ

ivory sleet
#

Ah

#

Do you mind sharing the code?

patent bloom
#

sure, i'll pm?

ivory sleet
#

?paste

undone axleBOT
patent bloom
#

that's the main part

ivory sleet
#

And any errors?

patent bloom
#

no errors

#

my frantic research is saying i'm compiling incorrectly, and i'm not sure what i missed

ivory sleet
#

Elaborate on your frantic research

patent bloom
#

google, spigot forums, spigot docs, youtube

#

😂

ivory sleet
#

So how do you build your plugin?

knotty shell
#

anyone got the NMS dependancies offhand? for 1.18

ivory sleet
#

If you’ve done everything correctly you’d use maven clean install iirc

civic apex
#

what is a reliable way of cancelling knockback?
What I have right now is a EntityDamageByEntityEvent that takes the damaged entity's velocity, saves it then runs a task later (0 ticks later) and sets the velocity to the saved velocity

rough basin
#

Even when an entity is in NoAI state, is it possible to detect another entity within a certain range and use it as a trigger for an Event?

patent bloom
#

i tried two
project structure > artifacts > + > JAR > From modules with dependcies > Include in project build > OK > build artifacts

and maven > package

civic apex
#

? whats that

ivory sleet
#

?jd-s

undone axleBOT
civic apex
#

VelocityEvent?

ivory sleet
#

oh nvm its only for players

civic apex
#

but i only want to cancel it when they get hit