#help-development

1 messages · Page 1476 of 1

eternal night
#

I already showed you the method o.O

cedar hamlet
#

so just remove the stick from the inventory?

eternal night
#

I mean, whenever it is used (idk what event you call this logic in) you replace it yes

#

like e.g. on right click

cedar hamlet
#

ok

eternal night
#

you just update the item the player is holding in their respective hand

cedar hamlet
#

gotcha

tribal holly
#

Is there any way to "touch" the main world of a server ?

#

like remove it or change it before load ?

opal juniper
#

Did you actually change the item?

severe folio
#

iirc Player#updateInventory wont do anything unless its the inventory that the player owns (Player#getInventory())

hidden torrent
#

How do you implement placeholder support for a plugin?

wraith rapids
#

it just generally updates the contents of the inventory, as in resends them

final imp
#

Hi, someone have some plugin for the premission?like for make vips, admins, etc

wraith rapids
#

it's there to combat against client-sever desyncs and shit

severe folio
#

fair

wraith rapids
#

unless cancelling click events and spam clicking is involved, it probably does nothing

final imp
#

another?

severe folio
#

PermissionsEx? (outdated though)

chrome beacon
#

Why not LuckPerms?

wraith rapids
#

where's elgar

severe folio
#

^^ its probably your best option

final imp
#

because I don't know why he won't let me put the prefixes

chrome beacon
#

wdym?

shy orbit
#

anyone haves some fun tools plugin? like a plugin that have spells for people or buffs, want to spice up my smp

chrome beacon
#

;/

shy orbit
#

ty

pulsar zenith
severe folio
#

You need a chat plugin to display the prefix afaik

final imp
#

any?

chrome beacon
#

?

#

Yeah read what we've sent

lyric grove
#

what v is the volume?

quiet ice
#

isn't it volume, pitch?

lyric grove
#

yeah thats what i mean

quiet ice
#

Though the context may be dependent

#

?jd just note that this is also a thing

quiet ice
#

Did you even modify the lore?

lyric grove
quiet ice
#

are you sure the code is run?

#

If updateInventory does not work you might be doing something wrong as I recall that this is not an issue when I last tried something like this.

#

However this has been quite a while so my memories could have been false there, at which point you might want to try things like Inventory#setItem explicitly a second time to see if that works

restive lion
#

I'm super new to making a plugin but is there a way to create section with out using createSection method?

compact haven
#

can you create a skull that has a texture of an image? like instead of having the base64 json that leads to a minecraft texture api url, can u use a plain image ? lmao

empty roost
#

Is it possible to control mobs (if it's possible, ofcourse it will has latency) in spectator mode while we're inside of them?

severe folio
#

ItemMeta#setLore(Collection<String>)?

ivory sleet
#

It takes a List iirc

severe folio
#

^ List sorry, my bad

#

wdym

quaint mantle
#

how can I create placeholder with variable in skript?

tired spoke
#

i found a plugin that starts from 1.12.2 version and has 1.8 support with Maven

#

can probabbly be a good way Maven?

dusk flicker
quaint mantle
#

OH OK

wraith rapids
#

skript is gay

ivory sleet
#

I humbly deny the request of getting spoonfed for ArisTheMage

dusk flicker
#

?spoon

queen dragonBOT
#

Spoonfeed a newbie for a day and they'll come back with more questions. Teach them to find their own answers and you'll both be better off: you won't get stuck answering the easy questions and they'll be much more productive than before.

wet breach
#

seems like a lot of people need help these days

chrome beacon
#

Yeah

#

Bruh

wet breach
#

?jd

chrome beacon
#

We are not going to spoonfeed you

#

Learn basic Java and come back

wet breach
#

even then, at least have some kind of code yourself. This place is to help people who are stuck on a piece of code, not to be given code at a whim

chrome beacon
#

^

wraith rapids
#

it does

#

you just don't know what it's supposed to do

#

so you call it broken when it doesn't do what you want

cedar hamlet
#

@ivory phoenix I’m the Worst person to ask for answers mate

#

I barely know anything

ivory sleet
#

Untrue

#

I am the worst person

wraith rapids
#

so, uh

#

say I have a binary heap implementation

#

an array based one, that is

#

for removing an element, you normally would first move the last element of the array to index 0, and then down-shift it repeatedly until the heap property is restored

#

if I were to reimplement this operation by left-shifting the entire array by one element, and then checking restoring the heap property for its elements

#

that should outperform the former implementation if the elements are already sorted, yes?

#

mostly already sorted

#

trying to optimize my priority queue to take advantage of the almost-sorted input i'm giving it

snow bane
#

so i have this class

#

which this class extends

#

and is instantiated here

#

shouldnt the while loop begin running when this class is instantiated, because its in the constructor?

#

im new to extending so i prob got something wrong there

#

also i know about naming conventions im just way more used to python and keep forgetting to switch

#

especially with methods

wraith rapids
#

don't expose state directly by making fields public; write accessor methods for them and maintain the state internally

#

use the java naming conventions

snow bane
#

i know with the naming conventions yeah

wraith rapids
#

i don't think those fields need to be static

snow bane
#

for 80% of the files i respect it well

snow bane
wraith rapids
#

that while loop will crash the server

snow bane
#

i see

wraith rapids
#

that while loop will never stop

#

which means that the method call will never return

#

which means that the onEnable method call will never return

snow bane
#

oh

#

ohhh

wraith rapids
#

which means that the server will literally never be able to progress past loading your plugin

#

which means that it dies

snow bane
#

can you run a while loop asynchronously?

wraith rapids
#

yes, but don't do that

snow bane
#

alright

wraith rapids
#

if you do that, you will spin an entire thread at maximum possible speed checking whether a player is shooting every 400 nanoseconds or something

#

you will melt down the processor

snow bane
#

well the while loop was a solution to see if an event passed in a different class

#

i couldnt think of anything else

#

events is an instance of this class

wraith rapids
#

don't check if an event happened

snow bane
#

because if i were to write the event in the Weapon class i wouldnt be able to register it cuz it has a constructor

wraith rapids
#

notify the thing that wants to know if an event happened, that an event has happened

snow bane
#

how would i do this?

wraith rapids
#

depends entirely on how you've laid out your project

snow bane
#

just do if (event happened) do something?

wraith rapids
#

no, that is checking whether an event happened

#

you don't want to do that

#

you want to do stuff when an event happens

snow bane
#

hm

#

maybe i could make the shooting event run through the event

#

or could i make something in the event to make this run

wraith rapids
#

maybe try something simpler as your first project

snow bane
#

this isnt my first project

wraith rapids
#

it kinda looks like it is

snow bane
#

its my second project so fair enough lmao

#

i need to make this for someone tho so i have to finish it

wraith rapids
#

the someone might be more pleased with not getting anything at all than getting what you manage to make at this stage

#

tell them to wait 2 months

snow bane
#

harsh but i can agree with you

#

i should genuinely stick to python when someone asks me to make something

wraith rapids
#

you might not notice it but you will be making a lot of rookie mistakes and if someone actually wants some sort of a product, they won't be happy when they learn that they need to basically rewrite everything if they want to actually use it on prod

#

if it's just something among friends or whatever it's probably fine

#

just make sure they know it's not your finest work

snow bane
#

the rest of the plugin works perfectly fine

#

they tested it out and said it was perfect

#

its just the gun part

wraith rapids
#

thing with development is that in addition to working, the thing should be maintainable

snow bane
#

probably because everything else was waaay easier to make

snow bane
#

trust me im really not proud of this

wraith rapids
#

somebody needs to update the project 2 years from now they'll be jumping off a bridge

snow bane
#

if the naming convention is awful the rest of the project usually is

wraith rapids
#

anyway, what are you trying to do

#

like, concretely

snow bane
#

ok so

#

i want to have it

#

where when a play clicks their mouse

#

and are holding a specific itemstack

#

a gun right

#

it shoots

#

problem is

#

i cant make a playerinteractevent inside of the Weapon class

#

because it has a constructor

#

so i made one outside of it

wraith rapids
#

the last 3 lines you said sound very wrong

#

show me what you did, in particular 'making one outside of it'

snow bane
#

wait first

#

is it possible to register an event when the class has a constructor?

wraith rapids
#

an event handler? yes

#

has nothing to do with constructors

#

every object has a constructor

snow bane
#

no i realize

#

but in this class

wraith rapids
#

add a new method

snow bane
#

the class is made to be extended

wraith rapids
#

@EventHandler public void myhandler(MyEvent event) {}

#

then make the class implement Listener

snow bane
#

therefore if i have to register the class i have to pass those variables

#

which i cant

wraith rapids
#

sure you can

snow bane
#

because the only reason they are there is for an extension to "super" it

wraith rapids
#

consider deleting everything and starting from scratch

snow bane
#

fair enough

wraith rapids
#

basically, I have no clue what you are doing, but this is how it should be done

#

number one

snow bane
wraith rapids
#

object oriented

snow bane
#

yes

wraith rapids
#

have an object represent each weapon type

#

number two

snow bane
#

thats what im doing

wraith rapids
#

have each such object have an id

snow bane
#

oh

wraith rapids
#

f.e a String, "gauss-rifle"

snow bane
#

i havent learnt that yet

#

like a hashmap?

wraith rapids
#

number three

#

have a map that maps the id to the object

#

String -> Weapon

#

number four

#

have a single listener

#

check the persistent data container of the clicked item

#

check if it has a specific tag, say, myplugin:weapon-id

#

if it does, grab the value

snow bane
#

yeah

wraith rapids
#

query the map with it

#

retrieve the object

#

then spin logic on that object

snow bane
#

alright

wraith rapids
#

right now you have one class for each weapon

#

what you want is one object for each weapon

snow bane
#

so i should make an object for each weapon

#

yeah ok

#

i thought extending the basic properties would save time

wraith rapids
#

if you have an object per weapon, you can do

Weapon bigGun = new Weapon(10);
Weapon biggerGun = new Weapon(100);
Weapon biggestGun = new Weapon(1000);
#

where the number would f.e set the damage of the weapon

#

instead of having to write a new class for each one

compact haven
#

big bigger and biggest

snow bane
#

oh

#

so really this saves way more time

wraith rapids
#

you can combine it with extension

snow bane
#

now that i think about it

wraith rapids
#

for example you can have a class Weapon with only basic attributes

compact haven
#

you should do that if you have a configurable amount of weapons as well ^

wraith rapids
#

and a GrenadeThrower that extends Weapon, that modifies the logic slightly

snow bane
#

thats what i was thinking

#

because lots of weapons have different firing types

wraith rapids
#

but don't restrict yourself to a single class per weapon

snow bane
#

hence the extending

wraith rapids
#

yeah, that's fine

snow bane
#

ohh

#

so i should go like

wraith rapids
#

but you still want to maintain the OOP nature of things

#

that is, using objects for things

#

the classes are just templates

#

you could have 5 different GrenadeThrowers with just writing 1 class

snow bane
#
Marksman sniper = Marksman(5)
Automatic ak-47 = Automatic(40)
#

like this kind of

wraith rapids
#

myeah

snow bane
#

alright

#

now with that listener

#

how would i make it check that the gun "shoots"

#

assuming i cant pass the main weapon class in register events

wraith rapids
#

for the listener, the listener itself shouldn't be concerned with what a gun does when a player clicks

#

the listener's purpose is to listen, and forward the information about the events

#

it is the Weapon that chooses how to deal with that information

snow bane
#

i see

wraith rapids
#

so, first set up the Map of String -> Weapon

#

then, create yourself a Listener

snow bane
#

yeah

wraith rapids
#

the Listener would query this map

snow bane
#

so like

wraith rapids
#

have some abstract or default methods on the base Weapon class

snow bane
#

event runs -> get this weapon

wraith rapids
#

myeah

snow bane
#

kk

wraith rapids
#

have some abstract methods like onRightClick, onLeftClick, onSneak on the Weapon base class

#

and then have the listener call those

#

Weapon clickedWeapon = map.get(weaponId);
clickedWeapon.onClick();

snow bane
#

look this is probably obvious to you and people with a brain but thats genius why cant i think of these things

wraith rapids
#

it comes with experience

#

you learn to leverage the advantages of object oriented programming and the language

snow bane
#

hope so

#

yeah im def not used to OOP because python basically doesnt have it lmao

wraith rapids
#

imo before writing a single line of code you want to sit down and think about the layout of your project model

snow bane
#

the extended weapon object?

wraith rapids
#

it'd return a Weapon of some kind

snow bane
#

alright

wraith rapids
#

we don't need to know what kind of weapon

#

just that it is a weapon

#

and has the abstract methods declared on Weapon

snow bane
#

and the get method just passes whatever we match the weapon too

#

like a string or the itemstack

wraith rapids
#

the get method takes a single parameter, the key

snow bane
#

can the key be anything or just a string?

wraith rapids
#

a map aka a dictionary maps keys to values

snow bane
#

ohh

#

ok yeah

#

so its literally just like a dict

wraith rapids
#

it can be anything you want it to be, but only one type of key allowed per map

snow bane
#

i see

wraith rapids
#

f.e a Map<String, Weapon> would use String based keys

#

a Map<ItemStack, Weapon> would use ItemStack based keys

snow bane
#

i see yeah

wraith rapids
#

although the latter sounds good on paper, we don't want it

#

because maps use equals to compare keys

#

meaning that the keys must match exactly

snow bane
#

so like i could pass the name of the weapon instead as a string?

#

with getItemMeta.getDisplayName

wraith rapids
#

which means that if someone changes the name of our itemstack or it loses durability or is somehow not identical, it won't recognize it as the same key

#

well, that is the old fashioned way yes

silk tusk
#

Is there a way to tell when a player stops breaking a block before the block actually breaks? I wrote a plugin to allow players to break bedrock, but now I am trying to animate the breaking with ProtocolLib packets.

wraith rapids
#

but then you need to stop players from renaming items and all that jazz

snow bane
#

so

#

can i get the item key?

wraith rapids
#

the preferred method is to use an item's persistent data container to store a value

snow bane
#

alright now thing is

#

i have 0 idea what that is

wraith rapids
#

but that might be a bit involved for you considering you're not familiar even with maps

snow bane
#

well i understand maps now if they work just like dicts as u said

wraith rapids
#

use the displayname for the time being and switch to proper pdc id shit later

snow bane
#

fair enough

wraith rapids
#

a persistent data container is basically a map

snow bane
#

im dogshit with data anyways i have a seething hatred for json

wraith rapids
#

but it has facilities to serialize and deserialize data to a primitive format

#

so the data can be persisted over restarts and shit

snow bane
#

i see

wraith rapids
#

simple on paper but it involves jumping through some java generic type parameter hoops so it looks confusing

snow bane
#

sounds like it

snow bane
#

thanks dude

#

@wraith rapids alright im gonna go try that out now

#

na but genuinely ur def the most helpful person ive ever met on discord

#

if i knew u irl id buy u a drink or smth

wraith rapids
#

lol

snow bane
#

have a great day man

silk tusk
#

Is there a way to tell when a player stops breaking a block before the block actually breaks? I wrote a plugin to allow players to break bedrock, but now I am trying to animate the breaking with ProtocolLib packets.
(Reposting so it isn't buried)

wraith rapids
#

i've found that one of the best ways to get a thorough understanding of something is to figure out how to explain it to someone uninitiated

silk tusk
#

definitely

wraith rapids
#

i hang around the spigot and paper discords repeatedly telling the same shit to a million people every day because they provide an endless supply of the uninitiated

#

there, uh, is a packet for that I think

silk tusk
#

Also a great way to figure out what is wrong with your code.

wraith rapids
silk tusk
#

Yeah I guess I can just listen for the stop breaking packet

wraith rapids
#

check if the protocol documentation mentions the packet by name

#

there is no event for it in the api

silk tusk
#

Since I'm already doing weird packet stuff

snow bane
#

@wraith rapids oh one more question

#

if i make a hashmap

#

do i need to make a seperate one for each extended class?

#

or does having it just be <String, Weapon> enough if Weapon is extended in said classes

silk tusk
#

A map of Weapon objects can store subclasses of Weapon just fine as well

snow bane
#

oh perfect

wraith rapids
#

since each class extending Weapon is, by definition a kind of Weapon, just one map is fine

snow bane
#

thanks guys

wraith rapids
#

that is one of the big advantages of oop and polymorphism and shit

#

there are all sorts of rectangles, and all squares are rectangles, but not all rectangles are squares

#

likewise, there are all sorts of Weapons, and all Flamethrowers are Weapons but not all Weapons are Flamethrowers

snow bane
#

i see i see

#

well

wraith rapids
#

this is why whenever you're extending a class, you can never remove anything from it

#

you can't remove any functionality

snow bane
#

the fact that if i just did this i wouldnt have spent a week of work for nothing

wraith rapids
#

you can only modify and add

#

which then translates to that we can have a Weapon, and not care what kind of Weapon it is

#

since all things that extend Weapon must provide at least the same things that Weapon itself does

snow bane
#

this look like what u mean?

#

oh minus the player and boolean at the top i forgot to remove them

wraith rapids
#

myes, looks about right

#

but, a few things

snow bane
#

yeah

wraith rapids
#

foremost, you aren't actually checking whether the map returns anything

#

if a map doesn't have a matching key, it returns nothing

#

aka null

snow bane
#

oh

#

wait let me edit it

wraith rapids
#

in python or whatever this would i guess roughly translate to a pointer that doesn't actually point at anything

#

so, you'll want to check whether weapon is null, that is, whether the variable named weapon points at any object

snow bane
wraith rapids
#

better, but now you're doing two lookups in the map, which is inefficient

#

you can have a variable with no value, an 'empty' variable

snow bane
#

so i should do if weapon != null instead?

wraith rapids
#

myes

snow bane
#

alr alr

wraith rapids
#

also, take heed of what the IDE is telling you

#

yellow underlining indicates a warning

#

hover over it to see what it is about

snow bane
#

ah it just says it may throw a nullpointer

#

which we kinda already figured out lmao

wraith rapids
#

quite a few methods can return nothing

#

for example the event.getItem() method might return nothing

#

which would then make the item variable empty

snow bane
#

fuck thats true wait

wraith rapids
#

and when you try to call .getItemMeta on the object in that variable, it explodes

#

because there is no object in that variable

silk tusk
#

When is ItemMeta actually null? It seems to be for AIR, but that's the only one I've noticed so far.

wraith rapids
#

only for air afaik

snow bane
wraith rapids
#

not sure about VOID_AIR and CAVE_AIR, but probably null for those too

snow bane
#

i gotta go eat lmao sorry dude

#

genuinely tysm for all the help tho

wraith rapids
#

once you're done eating, google early return

#

and check the other warning

snow bane
#

u should figure out a way to monetize it bruh people would pay the shit outta u

snow bane
nimble loom
#

How do I capture the output of the console?

tacit crystal
limber mantle
#

hi, i'm pretty stumped on how i add a soft dependency (KingdomsX) to my plugin. i'm using maven, and when i make the dependency's scope "provided", i get a ClassNotFoundException for all of those dependency's classes on runtime if the soft dependency is not installed on the server. i added Kingdoms to my plugin.yml's softdepend list. i have added several other softdepends which are "provided" as well, but they work fine; the issue is only with this plugin. does anyone have any clue as to why this is happening? or is this a problem with the KingdomsX plugin?

scarlet cape
#

How to make this speedrunner variable public tough?

public class AddRunner implements CommandExecutor {
    private Main plugin;
    
    public AddRunner(Main plugin) {
        this.plugin = plugin;
        plugin.getCommand("runner").setExecutor(this);
    }
    
    @Override
    public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
        
        if (!(sender instanceof Player)) {
            return true;
        }
        
        Player player = (Player) sender;
        World world = player.getWorld();
        Server server = player.getServer();
        Player speedrunner = server.getPlayerExact(args[0]); // how to make this public?
        
        return false;
    }
}
compact haven
#

why does bukkit snakeyaml not support list of configuration sections :(

silk tusk
#

Anyone know of a good way to calculate how fast a tool can break blocks? I don't really care about what the block is since I want to use it as the speed for a custom break animation and I can adjust the speed, I just want the speeds between pickaxes to be relative.

compact haven
#

actually

#

@worldly ingot do you know if bukkit can get a list of configuration sections

#

(snakeyaml seems to support it)

worldly ingot
#

yes

#

iirc I use it in VeinMiner

#

returns a List<?>. Iterate over the objects and check if instanceof ConfigurationSection

compact haven
#

o

#

didnt know that worked, thanks choco!

limber mantle
scarlet cape
quaint mantle
#

is there a way to call the autocomplete without having a command?

worldly ingot
#

i.e. the one just from chat that completes player names? no

compact haven
#

does Server#createBlockData(String) work like Bukkit.createBlockData("note_block[instrument=banjo,note=3]");

sullen marlin
#

Yes

compact haven
#

ty

tawdry plume
#

hey guys, what's a good listener that gets triggered every time a mob gets damaged? Would that be the entitydamageevent that gets triggered?

worldly ingot
#

Everything in Bukkit just directs to the Server methods, dlg

#

Yes, EntityDamageEvent gets called cowa but there are more specific events if you want. e.g. EntityDamageByEntityEvent

tawdry plume
#
    public void creatureDmg(EntityDamageByEntityEvent event) {
        if (event) {
            System.out.println("mob damaged");
        }
    }```
#

This is wrong but I'm hoping someone can help me with this logic

#

Will the function get triggered once the entitydmagebyentityevent is called ? I'm guessing I don't need the if statement?

#

don't laugh! I'm trying bruh

#

lol

worldly ingot
#

You don't, right. If you were to delete that if statement entirely, that method will get called every time an entity is damaged

#

Though you have to register the event as well

#
public class YourPlugin extends JavaPlugin {

    @Override
    public void onEnable() {
        Bukkit.getPluginManager().registerEvents(new MyEventListener(), this);
    }

}

public class MyEventListener implements Listener {

    @EventHandler
    public void creatureDmg(EntityDamageByEntityEvent event) {
        System.out.println("Entity was damaged by another entity");
    }

}```
#

That event will provide you with the information you need

#

Entity damaged = event.getEntity() for instance, you can operate on damaged which is the entity that received the damage

tawdry plume
#

this makes so much sense

#

thank you!

worldly ingot
#

o/

tawdry plume
#

next random question, I see commandsender has a getName method. How can I reference the mob getting damaged and get its name within the method defined?

#

I need to find a way to identify the entity getting damaged first then drill down into its getname event?

#

I just want the name of the entity, not sure If I'm looking for type instead? ex: cow, zombie, chicken

#

ah yes entity type it is

sweet oak
#

how to check what item a player is holding?

worldly ingot
#

not quite

#

That gets the hand that the player uses as their main hand in their client settings

#

player.getInventory().getItemInMainHand() will return you the ItemStack in their hand

tawdry plume
#

Choco wb! question, I'm trying to spawn a mob at another mob's location (the one getting damaged). Location loc = event.getEntity().getLocation(); spawnEntity(loc,EntityType.ZOMBIE);

#

spawnEntity is getting flagged saying it's undefined

worldly ingot
#

Yep. spawnEntity() is a method defined by World

#

Where do you think you might be able to get a World instance from?

tawdry plume
#

import org.bukkit.World;

#

?

worldly ingot
#

Well, yes, but you still need an instance of it

tawdry plume
#

lol ok

worldly ingot
#

Much like how you get the entity with event.getEntity() to get an Entity instance

#

Where might you think you would find a World?

tawdry plume
#

grrr

#

player?

worldly ingot
#

Player is one of them, or the entity that was damaged

#

all Entity instances have a getWorld() method

tawdry plume
#

oh yes better

worldly ingot
#

Additionally, even that Location has a getWorld()

#

loc.getWorld().spawnEntity(loc, EntityType.ZOMBIE);

tawdry plume
#
            event.getEntity().getWorld().spawnEntity(loc,EntityType.ZOMBIE);```
#

oh ok

worldly ingot
#

That would work too though!

tawdry plume
#

yours is cleaner though 😛

worldly ingot
tawdry plume
#

question, where can i get a list of all entities? i want to randomize which one is spawn

supple surge
#

Has it ever worked with CustomModelData?

worldly ingot
#

Do you know how to generate a random number?

tawdry plume
#

can I just make my own list of entity types?

compact haven
#

whats up

worldly ingot
#

If you're not sure how to generate a random number, a quick Google search for "generate random number Java" will yield good results

#

Though EntityType is an enum and all enums will declare a static values() method which gets you an array of the elements

tawdry plume
#

Random rand = new Random() then rand.entity

#

along those lines

tawdry plume
#

i can get something random from that array

worldly ingot
#

So access that array at some random index between 0 and that array.length, you're good to go

#

Worth noting that not all entities are spawnable though

tawdry plume
#

dude you're so helpful ty honestly

#

i've progressed a ton tonight with your help

worldly ingot
dusty herald
#

SecureRandom or Random

worldly ingot
#

ThreadLocalRandom is also an option. Again, Google is your friend there

#

SecureRandom is a tad overkill here tbh

dusty herald
#

overkill is good yes

worldly ingot
tawdry plume
#

lmao

supple surge
# compact haven I can try to help?

I'm making a Totems Effect plugin and I want the output totem to be the specified CustomModelData

This is the code that I am doing, also I am very nevo in this hehehehe

dusty herald
#

no

supple surge
#

The Effect appears but not the totem with the specified modeldata 3 ...

worldly ingot
#

Haven't added it or dropped it or anything

#

You just created it, that's all

scarlet lintel
#

h

worldly ingot
#

Code looks fine otherwise

fallen nova
#

quick question! how would i go about converting a string like "STONE" to something equivalent to Material.STONE?

worldly ingot
#

Material.matchMaterial(String)

fallen nova
#

nice thanks

worldly ingot
#

null if it doesn't exist

scarlet lintel
#

epic

compact haven
#

Choco he's trying to make a totem fly around the user

#

but a totem with a custom model data, does the api even provide a way to do that

worldly ingot
#

oh I see

#

is that something you can do?

compact haven
#

honestly no idea

supple surge
#

Yes it can but I don't know how to do it
But if i found this

scarlet lintel
#

is there a convenient way to convert JSON into some sort of table that can be accessed via code?

{
  "Thing1":"yeah",
  "Thing2":{
    "Hello":1,
    "World":2
  }
}
JSON.Thing1 //yeah
JSON.Things.World //2
lapis relic
#

Maybe Jackson databind

worldly ingot
#

Gson is shaded into Bukkit

supple surge
compact haven
#

gson is shaded into bukkit but not kotlin

#

sadge

worldly ingot
supple surge
#

It is but it is very obfuscated

worldly ingot
#

Oh I see

tawdry plume
#

Question, how can i make a variable of the entity that just spawned here? seems like it's of type loc and not entity loc.getWorld().spawnEntity(loc,EntityType.ZOMBIE);

compact haven
#

It seems it just sets the item in your offhand before it plays the effect

worldly ingot
#

They temporarily set the item in the hand to the totem with the model data, play the animation, then set it back

#

Yep

compact haven
#

then it sets it back?

#

yea

worldly ingot
#

You can just assign it

compact haven
#

if that works then u can make any item fly around u then cant u

#

🤔

tawdry plume
worldly ingot
#

I'd imagine it still has to be a totem

#

Yeah that should work okay, cowa

supple surge
#

It is only a totem with different CustomModelData are they are items ...

tawdry plume
supple surge
#

Examplee

worldly ingot
#

Oh, it has to be a LivingEntity, cowa

#

You can cast it as such if you want

#

Or, use the generic spawn() method instead

worldly ingot
#
Zombie zombie = world.spawn(location, Zombie.class);
zombie.setHealth(5);```
tawdry plume
#

oooo

worldly ingot
#

Using spawn() instead and a Class will return the exact type you spawned

#

That way no need to cast it

#

Reason Entity doesn't have setHealth() is because things like item frames, items, boats, etc. are all entities that don't have health

#

LivingEntity* however, does

tawdry plume
#

makes sense

odd sentinel
#

how do I give an item an enchantment but hide it in the lore? I tried setting the lore after the enchant but the enchant effect is lost. if I do the enchant after, the name shows in the lore

worldly ingot
#

You can add ItemFlags to ItemMeta

#

meta.addItemFlags(ItemFlag.HIDE_ENCHANTS);

tawdry plume
worldly ingot
#

Well, you'll still need that world instance from before ;p

#

loc.getWorld()

odd sentinel
worldly ingot
#

That's Paper, unrelated to Spigot

#

Better off asking there instead

tawdry plume
#

i feel like im getting burnt out lol so many changes

worldly ingot
#

Good tip for you by the way cowa. On Google, if you search "<insert question here> Spigot", you'll probably find a thread on the Spigot forums answering your question

#

Especially a lot of the beginner ones 🙂

tawdry plume
#

sorry yeah i should do more of that

#

i just have the docs open and you guys while coding

#

ill use google more

worldly ingot
#

Is oki. I don't mind answering questions at all, but a lot of them are definitely already answered 😄

tawdry plume
#

thanks!

compact haven
#

choco hows the doggies doing

worldly ingot
#

gud gud. doggoing like usual

compact haven
#

thats good 😄

weak mauve
#

ummm? can any1 help me, i want to add placeholder (like %vault_eco_balance%) to my plugin, i have hooked to papi but no luck :/

compact haven
#

are u sure u followed everything step by step?

weak mauve
#

yep

#

oh yes i know where im wrong

#

import in another file and call it in other

#

PlaceholderAPI.setPlaceholders()

any1 tell me more abt this or give me some documentations

tawdry plume
#

I'm trying event.getEntity().teleport(event.getEntity().getWorld(),2.0, 5.0, 3.0); but it seems to be referring to the other method which asks to specify PlayerTeleportEvent.TeleportCause cause. Any ideas how i can just specify a location to teleport the entity away?

sullen marlin
#

Look carefully

#

You need to pass in a location

#

Make a new Location(..)

tawdry plume
#

Let's hope this works lol, no errors in code atm

#

event.getEntity().teleport(new Location(event.getEntity().getWorld(),2.0, 5.0, 3.0));

coral sparrow
#

World.getName() = the folder* name right?

sullen marlin
#

Folder name

late dove
coral sparrow
tawdry plume
#

one last question for tonight, i'd like to kill off an entity with the damage method within Damageable. So I tried event.getEntityType().damage(10.0) but it's not working. The method damagable(double) is undefined for the type EntityType

#

any tips? 🙂

#

also, idk if i can use the sethealth method because some of the entities may be not alive (zombies)?

sullen marlin
#

getEntity not getEntityType

tawdry plume
#

hmm still nothing @sullen marlin

#

and derp i should've noticed that

#

event.getEntity().damage(10.0);

#

maybe it's not damageable

eternal oxide
#

the Entity has be an instance of Damageable

#

be sure you import the correct Damageable

tawdry plume
#

gotcha, hmmm what's the best universal way to kill all types of entities? or would i have to include if statements for those who are damageable and/or those who i can set their health to 0?

tawdry plume
#

import org.bukkit.entity.Damageable;

#

i imported the entity one

eternal oxide
#

?jd search for damageable and you will see

tawdry plume
#

lol

grim sage
#

Hey ! Trying to change the portal location of an ender dragon if someone know how to do it : )

near crypt
#

how can i get the name of a player that sends one command, in another command?

grim sage
near crypt
#

no in another class

#

the player name in another command uk?

grim sage
#

When you call a method in a other class from your onCommand method ?

near crypt
#

ill try it thx 😉

grim sage
#

It was a question x)

#

Because I don’t enderstand what do you want to do exactly

near crypt
#

oh okay so i want to "save" the name of the sender of one command. Then i want to get the name in another class (another command)

#

@grim sage

grim sage
#

Hum

#

I see

#

so you can create a variable in an other class, when the command is executed you put the name in this variable like this
1st in your command class

YourClass.setPlayerName((Player) sender)

#

And you will be able to get it in an other class with

2nd In the class you wan’t use the name

YourClass.getPlayerName()

near crypt
#

okay

#

and your command is the first command?

#

uhm yourClass

#

sry

grim sage
#

Of course your storages classe have to be setup like this :

3rd In what class you want, like a manager or a utility class for example

Private static String playerName;

public static String getPlayerName(){return playerName;}

Public static void setPlayerName(Player player){playerName = player.getName()}

near crypt
#

okay i see

#

thank you 😉

late dove
#

How can I get an enchantment card from a book? How can you put an enchantment card on a book?

torn oyster
#

how do i completely prevent saving of a world

#

i've tried unloading onDisable

grim sage
#

Hey ! Trying to change the portal location of an ender dragon if someone know how to do it : )

eternal oxide
#

Do you mean teh portal that spawns when it dies?

torn oyster
#

even onDisable

drowsy helm
#

what are you trying to achieve

torn oyster
#

not saving my world ondisable

#

and with autosave

drowsy helm
#

yeah why

#

is this for a minigame

torn oyster
#

yes

#

i have tried unloading the world onDisable

#

very unreliable

#

sometimes works

#

sometimes doesnt

eternal oxide
#

WorldSaveEvent and ChunkUnloadEvent.

torn oyster
#

WorldSaveEvent?

eternal oxide
#

Not cancelable it seems

torn oyster
#

yea

#

well thats kinda an issue lol

eternal oxide
#

Try listening to the ChunkUnloadEvent and call
setSaveChunk​

coral sparrow
#
                e.getPlayer().setHealth(0);
            }
        ```
This tries to kill the player until he is out of water, So I just want to kill him once... Can someone help
drowsy helm
#

check if their health is 0 before you do it

#

so you're not calling it over and over

eternal oxide
#

if (!e.getPlayer().isDead()

coral sparrow
coral sparrow
torn oyster
torn oyster
#

its 1.8

eternal oxide
#

shoo

near crypt
#

how can i say that a player can only execute the command once after a reload?

worn tundra
#

What do you mean?

#

Why only once?

near crypt
#

nevermind

#

?paste

queen dragonBOT
near crypt
#

does Bukkit.reload() reload the server? like /rl?

near crypt
#

thx

torn oyster
#
            if (!p.hasPermission(getPermission())) {
                p.sendMessage(getConfigString(plugin, "no-permission"));
                return;
            }```
#

i have permission

#

this isnt working

eternal oxide
#

is this for a command?

torn oyster
#

yes

#

bungeecord

grim sage
eternal oxide
grim sage
#

sure ? because I saw a plugin doing it

#

he probably remake an custom dragon ai

eternal oxide
#

You can not change the portal location. You can mess with the AI

burnt current
#

Hey Does anyone know how I can add custom skulls from Minecraft-Heads.com to a newly created inventory in Spigot?

tribal holly
#

Hi i'm trying to move a file to the server folder but it tell me that "the process cannot be access cause it already use by an other process"

#
private void moveFile() {
        File source = new File(folder + File.separator + "map" + File.separator + "Daedalus");
        File target = Bukkit.getServer().getWorldContainer();
        System.out.println(target.getAbsolutePath());
        System.out.println(source.getAbsolutePath());

        try {
            Files.copy(source.toPath(), target.toPath(), StandardCopyOption.REPLACE_EXISTING);
        } catch (IOException e) {
            e.printStackTrace();
        }
    }```
eternal oxide
#

Why are you trying to replace files?

tribal holly
#

to reset a map

#

on server load

eternal oxide
#

you'll have to fully unload the map first

tribal holly
#

the map doesn't exist yet in this case

thick tundra
#

hey good morning! Im currently in the progress of making a minecraft network for my school. but i want to use multiple servers with a bungeecord connection. that part is easy. What i now want to know if its possible to save minecraft world in a folder, that other servers can access

tribal holly
#

after i will load it

eternal oxide
#

If it says the file is in use then its already in use

tribal holly
#

but the file doesn't exist yet to

chrome beacon
eternal oxide
#

what does the error say? exactly

tribal holly
#

i'm trying just to move Daedalus/ file to server file

eternal oxide
#

is that a file or a folder?

tribal holly
#

folder

#

"The process cannot access the file because this file is in use by another process"

thick tundra
chrome beacon
#

Yeah don't use the same world use copies

eternal oxide
thick tundra
#

oh okay, and could i maybe use a database that saves all the world files?

#

so that it saves it, then copies the world over to the server. and then loads that world?

chrome beacon
#

but why

lyric grove
#

im getting this error

chrome beacon
#

Yeah you're accessing an argument that doesn't exist

#

Intellij even warned you

#

Why did you ignore that warning

lyric grove
#

oh thanks

thick tundra
#

okay. my plan is to save the worlds on 1 file server. then let spigot access that world via a connection. when a player wants to invite another player to the world and the server is full, i want to unload and save the world, transfer both players to a diffrent server, then load that map on the new server, and teleport the players to that world

chrome beacon
#

What why would you do that

#

There is no reason to create a new server with the same world. Just let the invited player join the server that's already running

thick tundra
#

so i can let 5000 player play on one server, from my past knowledge its not smart to let 5000 players on 1 server, which hosts all the world thats gonna lag really badly so i want multiple server which can contain those players split over multiple servers

#

the school im working for is really really big hahaha

chrome beacon
#

Yeah why are you planning for a huge network 5k players already. Also your solution will be quite bad when it's running

thick tundra
chrome beacon
#

Yeah

ivory sleet
#

Lmao

#

Yeah strauss

#

It probably has an api

burnt current
#

how do you mean?
So you have to use this url from the head to get it into the plugin. But with which lines of code can I put the skull as an item in an inventory?

chrome beacon
#

?jd

burnt current
#

thanks
but I also roughly know how to create an item. But I don't know which lines of code can be used to put a custom skull in an inventory

chrome beacon
#

search for addItem

#

;/

ivory sleet
#

so you should probably create a cache to cache the textures fetched from the database

#

or like head texture thing

burnt current
#

ok i will try, thank you

quaint mantle
#

is it normal that Player.sendTitle is deprecated?

chrome beacon
#

Use the right one

#

?jd

quaint mantle
#

What's the "right one"?

chrome beacon
#

Look at the JavaDocs

quaint mantle
#

I did

#

But in eclipse

#

It says that it's deprecated

chrome beacon
#

Then use the one that isn't depricated

#

It tells you in the Javadocs

quaint mantle
#

The method sendTitle(String, String) in the type Player is not applicable for the arguments (String, String, int, int, int)

#

player.sendTitle("Spawn", "Welcome to the Lobby", 30, 150, 30);

#

What i'm doing wrong?

ivory sleet
#

What version are you on?

quaint mantle
#

1.8*

chrome beacon
#

Yeah you might have to use the depricated method

#

Since you're way out of date

#

You should concider updating

quaint mantle
#

I'm making a PVP server that's why

chrome beacon
#

It's time to move on

quaint mantle
#

How should I do then

#

PvP servers are on 1.8

#

not in 1.16

ivory sleet
#

iirc there's a TitleAPI that works for 1.8.8 which has a method that can specify the fade in, duration and fade out

chrome beacon
quaint mantle
#

Cool

chrome beacon
#

and if you're just going to copy other servers you're not going to get anywhere

quaint mantle
#

Damn I cannot even ask for help to create a PvP server for my friends and me? I just asked for a question for sending titles

chrome beacon
#

And we awnserd

#

We've told you what to do

#

(Use the depricated method or install the TitleAPI plugin)

quaint mantle
#

I'm using the TitleAPI Plugin, thanks.

#

You can use packets & avoid using any apis

#

I'm good with the TitleAPI

ivory sleet
#

Or just use an api to avoid nms

quaint mantle
#

^

#

or just don't care about using nms because he'll stick with 1.8 regardless for previously mentioned reasons

#

🤷‍♂️

#

Why is NMS better than using API

#

or API better

#

I didn't say it's better, I just prefer not using API's because I like to keep my additional resources small

ivory sleet
#

I mean at the end both alternatives have pros and cons so yeah can't really blame anyone

wraith rapids
#

imagine if in over half a decade literally anybody would have forked the 1.8 spigot and backported any new api to it

scenic scarab
#

How do I check to see if I'm on the team I created on the scoreboard?
By the way, the version is 1.16.5.

sullen marlin
#

team.getEntries().contains(player.getName())

quaint mantle
#

Hi again, how can we delete blocks 10 seconds after it got place? I mean when someone places a block, just delete it after 10 seconds. I know how to use the BlockPlaceEvent, but I don't know how can we "wait" 10 seconds, anyone can help me?

candid galleon
#

Look into BukkitRunnables

royal hawk
#

How to do, so that pet follow to the player

ivory sleet
#

You might have to inject a custom goal into that entitys goalselector

candid galleon
#

^ sounds like a NMS thing

quaint mantle
candid galleon
#

it has a method called runTask(Plugin)

ivory sleet
#

You can use smtng like this

Bukkit.getScheduler().runTaskLater(JavaPlugin.getProvidingPlugin(this.getClass()), () -> { 
  //delayed code
},20L*10L);
candid galleon
#

but

#

dont do JavaPlugin.getProvidingPlugin

ivory sleet
#

yeah

candid galleon
#

use your own instance

ivory sleet
#

I mean most likely your plugin class loader will be the one loading that class thus the instance of your plugin will get passed but dependency injection would be better

tribal holly
#

is it possible to print in the consol on the same line ? (i test with \r but don't work there still a line return)

#

for a progress bar

severe folio
#

System.out.print()? if that doesnt work then idk

tribal holly
#
System.out.print("Progress : |" + progressString + "| [" + progressPercent + "%] | xxkB/s \r");```
#

and only print when a line return is done

severe folio
#

arent you supposed to start with \r

lyric grove
#

how would i check if a item is a block (no half slabs, signs etc...)

tribal holly
ivory sleet
#

Might wanna try PrintStream#write instead

tribal holly
silk tusk
#

I'm trying to make a custom anvil recipe by changing the output slot of the anvil with the PrepareAnvilEvent. The issue is that when there is no result in the anvil initially the player can't take the output item even though it shows up. Any clue how to let them take it out?

tribal holly
#

when player click on result it clear the anvil and setCurrent item to the result

#

only set result don't work

#

it's only "visual"

silk tusk
#

Is there a way to handle that one without having to move the click the manually? There are a lot of different click actions and I'm trying to avoid having to reimplement them all so that I don't break it.

tribal holly
#

you don't need to handle all only shiftclick and click

fallen nova
#

how do you run a class on player join?

tribal holly
wraith rapids
#

you can't run a class

severe folio
#

^

fallen nova
#

sorry haha im mega new to java

ivory sleet
#

Lol

fallen nova
#

just dont know the names of stuff yet

ivory sleet
#

It’s fine

tribal holly
lyric grove
#

how would i get the block name?

quaint mantle
#

you can't run a class but you can call a function

chrome beacon
lyric grove
#

thanks

quaint mantle
#

You can only get name in ItemStack form. Placed blocks don't have a name

chrome beacon
#

He's not asking for the custom name

#

And that is an ItemStack

tribal holly
wet breach
#

\r ?

tribal holly
wet breach
#

you need \n\r

tribal holly
#

and don't right while process is running

wet breach
#

as it depends which system you are on

tribal holly
#

i wanna replace the progress line

wet breach
#

well \r is return o.O

tribal holly
#

nop \r doing a carriage return (come back at the begining of the line)

#

and \n do a line return (go to next line)

wet breach
#

what console are you using?

tribal holly
#

good question

wet breach
#

using the mc console ?

tribal holly
#

got it

wet breach
#

not entirely sure if the MC console respects \r or not

tribal holly
#

he is not

#

this is why i'm trying to use PrintStream::write

wet breach
#

even so, it still matters on the console

#

if the console doesn't support it, then you are stuck with making a progress bar vertically more so then horizontally. Or just periodically print the progress instead

tribal holly
#

maybe a good feature request to spigot

#

"support \r" md_5

wet breach
#

no it has to do with the console that mojang implements

#

its a very basic terminal

tribal holly
#

all basic terminal handle \r

#

this is not a big deal to implement

wet breach
#

obviously you discovered that to not be true

severe folio
#

i do wanna test that tho

wet breach
#

it could mainly be because of the logger more so then the terminal

silk tusk
#

Spigot seems to do some cursor manipulation that the default game doesn't

wet breach
#

the logger causing the terminal to have a new line on anything printed

#

cursor manipulation in what way @silk tusk ?

#

the only thing I see that touches anything with the console is the logger

#

if you do test it, try a test without the logger @severe folio

severe folio
#

aight

wet breach
#

log4j does quite a bit with how everything is outputted

scenic scarab
silk tusk
wet breach
#

that is brigadier

odd tapir
#

hi, is there a way to create a placeholder without suffix? for ex. %name% instead of %name_whatever% with PAPI?

lost matrix
#

Does anyone have a code snippet to get a player head itemstack from a skull blockstate? I dont want to dig into that stuff. This doesnt work btw:

  public static ItemStack itemFromBlock(final Block block) {
    final Material material = block.getType();
    if (material != Material.PLAYER_HEAD) {
      return new ItemStack(material);
    }

    final ItemStack head = new ItemStack(material);

    final Skull skull = (Skull) block.getState();
    final OfflinePlayer skinPlayer = skull.getOwningPlayer();

    final SkullMeta meta = (SkullMeta) head.getItemMeta();
    meta.setOwningPlayer(skinPlayer);

    head.setItemMeta(meta);

    return head;
  }
eternal night
#

paper has get/setPlayerProfile. Spigot does not complete gameprofiles for offline players so they are not copied to the skull

#

if you want to actively copy it over, you'd have to reflectively copy over the profile and serializedProfile fields

round scaffold
#

im tying to make an aternos server for 7 people and i found the coding at this the website so i need help in installing this coding
can someone help me please

quaint mantle
#

is there an event fired when a shield is disabled?

kind coral
#

how could i make my own spigot?

#

like my own fork

eternal oxide
#

Why would you want to?

quaint mantle
#

^

kind coral
#

would like to randomly do stuff ahah

quaint mantle
#

if there isn’t an event fired whats the best way to detect when a shield is disabled?

eternal oxide
#

have you tried the playerItemBreak event?

quaint mantle
#

is the shield set as broken when its disabled?

#

that would make sense ig

#

im looking to extend/change the cooldown of the shield disable thats all

languid geode
#

@kind coral Well first you learn git then go to stash and clone the repo then learn java and make your changes

#

?stash

queen dragonBOT
kind coral
#

just searched up on the forum where i could find the stash

#

just used buildtools

languid geode
#

do you wanna upstream

#

sorry for the childish start most people asking this question are 9 year olds who dont even know what git is

kind coral
#

wdym

languid geode
#

nvm then

#

Do you want to be able to submit pull requests?

#

or is it for personal use

candid galleon
#

if you dont know how to get spigot's source, you probably shouldnt be messing with it

languid geode
#

^

#

yet so many ask

#

i get needing to be linked to stash it aint easy to find

candid galleon
#

?stash

queen dragonBOT
candid galleon
#

so hard

severe folio
#

?help

#

damn... worth a shot

late dove
#

What will an asynchronous method give me? I load data from the database, if this method is asynchronous, then it will not hang if the server hangs?

candid galleon
#

it is run on an asynchronous thread

chrome beacon
#

Yeah it won't freeze the server

candid galleon
#

it may or may not hang, regardless of the server's state

#

threads can hang depending on what you do on them

late dove
#

A large number of requests will be sent to the database!

sonic bronze
#

Hey there I could use some help with my DAO. I always end receiving this exception:
[14:46:06] [Server thread/WARN]: java.sql.SQLSyntaxErrorException: (conn=1183127) Could not set parameter at position 2 (values was 1)

My DAO looks like this:

    
@Override
    public boolean insertUser(UserDTO user) {
        Connection connection = DatabaseHandler.getDbConnection();
        try {
            PreparedStatement ps = connection.prepareStatement("INSERT INTO Users VALUES ('?', ?)");
            ps.setString(1, user.getUUID());
            ps.setInt(2, user.getXp());

            int result = ps.executeUpdate();
            if (result == 1) { return true; }

        } catch (SQLException e) {
            e.printStackTrace();
        }
        return false;
    }```
candid galleon
#

is there any more?

#

of the error

sonic bronze
#

It says that line 7 here is the problem and my Call looks like this:

    @EventHandler
    public void onJoin(PlayerJoinEvent event)
    {
/*        UserDTO user = new UserDTO(event.getPlayer().getUniqueId().toString());*/
        if (event == null)
        {
            Bukkit.getConsoleSender().sendMessage("PlayerJoinEvent is none!");
            return;
        }
        String UUID = event.getPlayer().getUniqueId().toString();
        UsersDAO usersDAO = new UsersDAOImpl();
        UserDTO user = usersDAO.getUserByPk(UUID);
        if (user == null)
        {
            user = new UserDTO(UUID, 1);
            if ( !usersDAO.insertUser(user) )
            {
                Bukkit.getConsoleSender().sendMessage("Could not find, nor create the user with UUID " + UUID + " in the database");
            }
            else
            {
                Bukkit.getConsoleSender().sendMessage("User with the UUID " + UUID + " was created in the Database");
            }
        }
        else
        {
            Bukkit.getConsoleSender().sendMessage("User with the UUID " + UUID + " was found in the database");
        }
    }

valid vigil
#

when handling an InventoryOpenEvent how can I see if the opened inventory is an enderchest?
I tried inventory == player.getEnderChest() but that doesn't seem to be working

candid galleon
#

line 7 is Bukkit.getConsoleSender().sendMessage("PlayerJoinEvent is none!");?

#

@valid vigil Inventory#getType

valid vigil
#

oh, thanks

sonic bronze
sonic bronze
candid galleon
#

what type does getXp return?

sonic bronze
#

Integer

candid galleon
#

interesting, try setting it to 0

#

so ps.setInt(2, 0);

sonic bronze
#

I will

#

@candid galleon same error, only the line java.sql.SQLSyntaxErrorException: (conn=1183127) Could not set parameter at position 2 (values was 1) changed to
[14:59:50] [Server thread/WARN]: java.sql.SQLSyntaxErrorException: (conn=1183764) Could not set parameter at position 2 (values was 0)

candid galleon
#

odd

#

maybe remove the ''s around the '?'

#

other than that no idea

sonic bronze
#

Yes I am already sitting on this problem for a few houes

candid galleon
#

yeah

#

looks like the 's fuck it up

sonic bronze
candid galleon
#

youll have to look into mariadb drivers then

#

looks like youre using native drivers

sonic bronze
#

Nah I use the MariaDB driver

candid galleon
#

oh yeah i see that

sonic bronze
#
  <dependency>
    <groupId>org.mariadb.jdbc</groupId>
    <artifactId>mariadb-java-client</artifactId>
    <version>2.7.3</version>
  </dependency>

I use this dependency /version of mariadb jdbc

winter arrow
#

when does ItemStack#getItemMeta() return null?

candid galleon
#

what's the error when you use it without the 's?

candid galleon
#

there might be other edge cases, but AIR will return null

sonic bronze
#

Ok I have to admin I dont know how this happend. you were right @candid galleon it works without the ' '. I thought that it didnt work and I found out that I need these. Maybe I miss understood one of my Errors and then applyed a wrong solution

#

So thank you a lot I wasted to much time on this xD

#

❤️

candid galleon
#

nice 🙂 👍

random ledge
#

Hello, I would like to ask about the problem. java.lang.NoClassDefFoundError: org/json/JSONObject
I'm using library json but can't run the plugin. this is log (https://pastebin.com/3gSWSfGc) Ty!🙏

chrome beacon
#

Use org.json.simple instead

random ledge
#

if use org.json.simple JsonObject / JsonArray can't use anyway
its said (The constructor JSONObject(String) is undefined)

sonic bronze
#

@candid galleon So I was still right xD In my SQL statements, when I use ... WHERE UUID=? I need to use ' ' ... WHERE UUID='?', else it will create problems

#

But in case I want to insert it I am not allowed to use them

#

Now it works just fine

sweet oak
#

How do I make something happen after a second of being executed?

quaint mantle
#

How can i detect if a hit is a critical hit in EntityDamageEntityEvent?

    public void onHit(EntityDamageByEntityEvent e) {
        if(e.getDamager() instanceof Player) {

            Player p = (Player) e.getDamager();

            if(critical) {} // How?

        }
    }
stone sinew
quaint mantle
#

getLastDamageCause is undefined

worldly ingot
#

It's part of the Entity, not the event

#

Though I'm not certain if that would return the last event or the one you're listening to

stone sinew
#

^^^^

quaint mantle
#

How what entity

#

the damager?

#

or the damaged

stone sinew
#

the damaged

quaint mantle
#

getEntity returns the damaged?

#

.getLastDamageCause() is defined there but not isCritical

stone sinew
#

I'm not seeing anything to check for critical actually. might have to do some research on that one.

quaint mantle
#

I Don't think thats the right channel for that

worn tundra
#

What's the best way to programmatically generate a vanilla structure at a given location?
Is it possible to do without using third-party libraries? (this is a private project)

Otherwise
Where can the vanilla structures NBT data be found on a server?

paper viper
#

You need NMS for this. Maybe look at stuff like WorldGenVillage

turbid ridge
#

Hey! I am trying to make a plugin where the recipient can add new lockpicks to a list of lockpicks. In the config I need to make a list of parameters like so

lockpicks:
    - item1:
      - name: "§aScrewdriver"
      - item-type: iron_hoe
      - description:
        - "description"
      - custommodeldata: 1
      #the durability indicates the amount of time the user can use the item
      - durability: 10
      #the efficiency is the chance in % to lockpick, every time the user use the item
      - efficiency: 10

But I am not sure if this is the right way to do it because If I retrieve a list from the config called lockpicks I cannot access the name of the objects returned. If there is a better way to do this I would love some help!

severe folio
#

im not sure if this is what you mean but... yaml lockpicks: item1: name: "§aScrewdriver" and use getConfig().getString("lockpicks.item1.name")

turbid ridge
#

I want the user to add as many lockpicks as they want

#

So they can add item1 and 2 and 3 and my code will be able to handle them

muted idol
#

hey there so i have this code
https://imgur.com/a/LGWoeFo
but how would i go about getting OverWorldLastLoc transfered to the other if statement?

sharp bough
#

what does it mean its not assigned? assigned to what

sly storm
#

you never gave it a value

sharp bough
#

my logic is:
when i run the command it adds the items and opens the inv in open()
and then if you click on it it checks if the inv clicked is the one created

#
        this.inv = inv;
    }```
its telling me to add this
sly storm
#

what are you trying to do

sharp bough
#

so its better quality

sly storm
#

yea

#

all that means is that it's never being used

#

you can just ignore that i'm pretty sure

#

does anyone know how to use the EntityShootBowEvent

muted idol
#

hey there how would i go about passing around an location?
here is my code

    @EventHandler
    public void PortalCheckOverWorldNether(PlayerPortalEvent e) {
        Player player = e.getPlayer();
        
        if (player.getWorld().getName() == "ManHunt") {
            if (e.getCause() == TeleportCause.NETHER_PORTAL) {
                World w = Bukkit.getWorld("ManHunt");
                
                double x = player.getLocation().getX();
                double y = player.getLocation().getY();
                double z = player.getLocation().getZ();

                
                Location OverWorldLastLoc = new Location(w, x, y, z);
                e.setTo(Bukkit.getWorld("ManHunt_nether").getSpawnLocation());
            }
        }        
    }
    
    @EventHandler
    public void PortalCheckNetherOverWorld(PlayerPortalEvent e) {
        Player player = e.getPlayer();
        
        if (player.getWorld().getName() == "ManHunt_nether") {
            if (e.getCause() == TeleportCause.NETHER_PORTAL) {
                e.setTo(OverWorldLastLoc);
            }
        }
    }
```the error is at `e.setTo(OverWorldLastLoc);`becuase it can't be resolved to an variable since i have not passed it around
ivory sleet
#

player.getWorld().getName() == "ManHunt"

sharp bough
#

whts the point of adding

            return;
        }```
isint the holder always a player? what else can hold an inv?
ivory sleet
#

some blocks

#

or blockdatas rather

sharp bough
ivory sleet
#

AbstractHorse, AbstractVillager, Barrel, BlastFurnace, BlockInventoryHolder, BrewingStand, Chest, ChestedHorse, Container, Dispenser, Donkey, Dropper, Furnace, Hopper, HopperMinecart, Horse, HumanEntity, Lectern, Llama, Mule, Piglin, Pillager, Player, ShulkerBox, SkeletonHorse, Smoker, StorageMinecart, TraderLlama, Villager, WanderingTrader, ZombieHorse

#

All interfaces which inherit the InventoryHolder interface

sharp bough
#

and what is "this"?

#

isint "this" the inv

ivory sleet
#

this is the instance

#

No

#

You see that predicate will always be false

#

or

#

true

sharp bough
#

no warning about that

ivory sleet
#

cuz it isnt a thing compiler can know about

#

dont look at history

#

using InventoryHolder to compare inventories isn't ideal at all

#

It may cause weird side effects and the api is not designed to be extended by you

sharp bough
#

and why does he use HumanEntity instead of player?