#help-development

1 messages · Page 246 of 1

harsh totem
#

good

wet breach
#

it shouldn't be null, rather it should be the projectile as the killer

#

But, all you should need to do though if you have a projectile is to get the ProjectileSource

trim creek
#

Both codes are the same but the one in the non-actualy-event class does not works. Everything is set up. Class is registered, method has @EventHandler.

#

How is attacker null when it is a palyeR?

solemn meteor
#

Thanks a lot!

wet breach
undone axleBOT
trim creek
#

There is no error actually.

#

Only thing when I added a check if attacker is null it returned yes

#

and idk how or why

wet breach
#

ok, but being able to see the code you are working with would be very handy

trim creek
#

which works

#

fine

#

and the reason why the first class almost looks the same as the second is... because I even copied the code from the second class into the first class, "maybe then you will do your job". Still I am null

wet breach
trim creek
#

no matter what event I used actuall

#

Entity or Player

#

both return the player as null

wet breach
#

yes because they are both wrong events

trim creek
#

oh...

wet breach
#

by the time those events are thrown it is generally too late to do anything, don't even think they are cancellable

#

however

#

there is events you should be listening to though for your purpose

#

if you need to know if they are going to die

#

check their health if its at 0

trim creek
#

it sure is wrid

#

I mean

#

as of I said

wet breach
#

you can detect death yes

#

I never said you couldn't

trim creek
#

class 2 works fine with EntityDeathEvent

#

but class 1 does not

wet breach
#

you just can't cancel the death event if I recall

#

you have to do it before they actually die

#

correct, and the event that would give them a killer is the one I provided above

#

all you do is check for their health being at 0

trim creek
#

And is even better and also easier I think

#

but still can't figure out why is killer null

#

I wonder what if I replace Player to LivingEntity

undone axleBOT
trim creek
#

oh wow one codeline won't work xd

remote swallow
#

^^^^

tardy delta
#

no need to set lore to a mutable list

wet breach
#

it should still be noted, also noticed what they were doing wrong, that killer is not a player if an arrow kills the player and the code needs to be modified to handle such things to get the real killer

trim creek
#

Seems logical

#

btw the code you sent I tried... Still sends me as null 😹

#

I swear Minecraft is the best game ever lmao

zealous osprey
#

now my graph has died 💀

wet breach
#

has to do with the way it is implemented

#

it is the whole reason projectilesource actually exists

trim creek
#

by palyerslol

#

I guess that should not matter. One event works, but the other doesn't. One detects the killer, the second doesn't.

#

And both code are almost the same.

#

Both classes are registered.

#

Which means... Either I am a stupid man who just mistyped something, or Java or Spigot/Paper is having trouble reading the same code at the same time lmao

#

It will throw NPE

#

Beucase killer cannot be set to a player

#

and code requires player

#

aaaand even trying to send a message to the killer does not appear lmao

#

Even made a new event to send messages to both killer and killed player. Killer is still null

snow compass
#

Why do like this? return this.lore == null ? null : new ArrayList(Lists.transform(this.lore, CraftChatMessage::fromJSONComponent)); when you only want to compere x lore with y lore (should be some raw method to get i also). Or method were you can check if two lore is equal.

It cost performance if you try access it to often, how it constructed.

#

I mean some say use spigot api were you can, but things like this I start to think on use nms instead and is not the only bug some has stick around for 10 years ether.

faint sedge
#

Hey, i'm struggling so hard to spawn Paricles in minecraft 1.8 can someone tell me what command should i use ?
I've already tried spawnParticle, but for some reasons i can't manage to cast it

vast kelp
#

Event for naturally spawned villagers?

golden turret
#

How can I check the interaction result of a player when he right-clicks with an item in his hand? Something like targetBlock.getInteractResult(playerItem)

vast kelp
#

Never used them but I'm seeing #useInteractedBlock and #useItemInHand return a Result

faint sedge
vast kelp
rotund ravine
faint sedge
distant ridge
#

ya'll i had IntelliJ installed but it was acting weird, so i uninstalled, re-installed, and now it doesn't recognize Bukkit as a dependency in IntelliJ even tho it compiles fine ... help?

#

like if i type getLogger() it doesn't show the Bukkit import at all

#

if i use the import from another file it then it highlights getLogger as an error

faint sedge
#

I've seen that there is playEffect() that exists but

Effect effect,
T data)```
i don't know what the data stands for
vast kelp
hasty prawn
vast kelp
#

Make sure your Minecraft client has particles enabled

vast kelp
hasty prawn
#

He sent that one, no?

vast kelp
#

Oh nvm I thought you replied to me

#

You right

distant ridge
river oracle
#

If not probably time to switch it'd only be logical to if so. Make sure the project is loaded correctly try invalidating caches

faint sedge
naive bolt
#

when i cancel the AsyncPlayerChatEvent my message is still sent?

distant ridge
distant ridge
naive bolt
#
            // Staff chat is enabled
            e.setCancelled(true);
            plugin.sendStaffChat(p,msg);
        }```
hasty prawn
# faint sedge tysm

Most of them will just have data be null, but something like... RECORD_PLAY wants the disc ID as the data.

naive bolt
#

the plugin.sendStaffChat(p,msg); is happening

naive bolt
#
    @EventHandler
    public void onChat(AsyncPlayerChatEvent e){
        Player p = e.getPlayer();
        String msg = e.getMessage();

        if(staffChatToggled.containsKey(p.getUniqueId()) || msg.startsWith("#")){
            // Staff chat is enabled
            e.setCancelled(true);
            plugin.sendStaffChat(p,msg);
        }
    }
river oracle
#

I hate intellij so I can't help to much sometimes invalidating caches works with idea products tho

distant ridge
faint sedge
distant ridge
#

i had to do the reinstall because it kept freezing up on me with no plugins

naive bolt
distant ridge
hasty prawn
naive bolt
distant ridge
naive bolt
#

not in a void

distant ridge
#

yes it does

#

you can't return a value or true/false but you can do a blank return

naive bolt
#

even inteli will tell u

remote swallow
#

add code after it then it wont shout

#

eg

public void onBlockPlace(BlockPlaceEvent event) {
    if (event.getPlayer().getGameMode() == GameMode.CREATIVE) return;
``` will scream at me 

```java
public void onBlockPlace(BlockPlaceEvent event) {
    if (event.getPlayer().getGameMode() == GameMode.CREATIVE) return;
    event.getPlayer().sendMessage("Block placed");
``` wont shout at me
naive bolt
#

hm k

#

the return appears to work somehow.

#

java moment

tardy delta
#

skill issue

wary topaz
#
public void listhomes(Player p) {
        int e = homeConfig.getConfigurationSection("Homes.Players." + p.getUniqueId()).getKeys(false).size();
        StringBuilder message = new StringBuilder();
        while (e > 0) {
            message = new StringBuilder(message + homeConfig.getStringList("Homes.Players." + p.getUniqueId()).get(e));
            e++;
        }
        p.sendMessage("Here is a list of your homes: " + message);
    }
remote swallow
#

what does the config look like

wary topaz
remote swallow
#

why are you making message a new string builder when it already as one

wary topaz
#

?

remote swallow
#

StringBuilder message = new StringBuilder();

#

message = new StringBuilder(message + homeConfig.getStringList("Homes.Players." + p.getUniqueId()).get(e))

wary topaz
#

Variable 'message' might not have been initialized

eternal oxide
wary topaz
#

omg

#

im so stupid

#

thank you ;D

#

ill be back if it doesnt owrk

desert loom
#

what are you trying to do with that code?

wary topaz
#

its gonna be a homes sort thing

#

ah danget it errored again

#
public void listhomes(Player p) {
        int e = homeConfig.getConfigurationSection("Homes.Players." + p.getUniqueId()).getKeys(false).size();
        StringBuilder message = new StringBuilder();
        while (e > 0) {
            message = new StringBuilder(message + homeConfig.getStringList("Homes.Players." + p.getUniqueId()).get(e));
            e--;
        }
        p.sendMessage("Here is a list of your homes: " + message);
    }

eternal oxide
#

Why not just for loop homeConfig.getConfigurationSection("Homes.Players." + p.getUniqueId()).getKeys(false)

remote swallow
#

yeah

wary topaz
#

i dont know how I would go around doing that im used to while loops

remote swallow
#

for (int i = 0; homeConfig.getConfigurationSection("Homes.Players." + p.getUniqueId()).getKeys(false) > 0; i++ {
code

eternal oxide
#
for(String key: homeConfig.getConfigurationSection("Homes.Players." + p.getUniqueId()).getKeys(false)) {```
desert loom
#

what is the output for that message supposed to look like?

wary topaz
#

"Here is a list of your homes: e1, e2, e3

desert loom
#

I recommend looping over the keys of "Homes.Players." + p.getUniqueId()and joining them with a StringJoiner

remote swallow
#
public void listHomes(Player player) {
  StringBuilder message = new StringBuilder();
  for(String key: homeConfig.getConfigurationSection("Homes.Players." + p.getUniqueId()).getKeys(false)) {
    message.add(key);
  }
}
wary topaz
#

Cannot resolve method 'add' in 'StringBuilder'

desert loom
#

it's append or something like that

remote swallow
#

try append

river oracle
wary topaz
#

ill try it

desert loom
#

also, if you want to have a delimiter I recommend using a StringJoiner instead.

river oracle
desert loom
#

yep

#

so if you want home1,home2,home3

#

using a StringJoiner instead of a StringBuilder would make that easier

wary topaz
#

alr im using string joiner ima test it

desert loom
#

for example

        StringJoiner joiner = new StringJoiner(","); // each string will be separated by a ,

        joiner.add("a");
        joiner.add("b");

        System.out.println(joiner); // prints a,b
wary topaz
#

it works!

#
        StringJoiner message = new StringJoiner(", ");
        for (String key : homeConfig.getConfigurationSection("Homes.Players." + p.getUniqueId()).getKeys(false)) {
            message.add(key);
        }
        p.sendMessage(message + "");
    }```

For anyone who might find this useful here is my code
eternal oxide
#

you could just String.join(stufFromConfig, ",")

desert loom
#

actually yeah you could do that too

wary topaz
#

ima just leave it as it is

fluid river
#

he

#

he

#
player.sendMessage(homeConfig.getConfigurationSection("Homes.Players." + p.getUniqueId()).getKeys(false).stream().collect(Collectors.joining(", ")));```
#
player.sendMessage(String.join(", ", homeConfig.getConfigurationSection("Homes.Players." + p.getUniqueId()).getKeys(false)));```
#

second is smaller

#

and don't use stream

#

so i guess a lot better

#

thanks oneliners for small codes

wary topaz
#

How can I delete a specific string list? For example:
Homes: Players: EthanGarey: E: X...

I want to delete "E" and everything in it.

wise pumice
#

Do you know the best way to add nametags next to a player's nickname?

wary topaz
#

add nametags?

loud frost
wary topaz
#

a

#

alr LOL

wise pumice
# wary topaz add nametags?

but how? nametagedit has errors, protocollib not sure how. I was looking for some api and found nothing interesting.

fluid river
#

config.set("Homes.Players.EthanGarey.E", null)
config.save()

wary topaz
#

pc lagging this might take a while

loud frost
#

Anyone know a resource to listen to the sounds in the Sound enum?

remote swallow
#

/playsound?

fluid river
loud frost
remote swallow
#

yeah

wary topaz
#

it worked thanks guys

fluid river
naive bolt
#

if i have something like ```yml
RTP-Menu:
buttons:
North_America: "Image.png"
South_America: "Image.png"
Europe: "Image.png"
Africa: "Image.png"
Asia: "Image.png"
Oceania: "Image.png"

how would i loop over these keys like "North_America"
#

is it getConfigurationSection

tardy delta
#

config.getSection("ripmenu.buttons")

#

loop over that and youre looping over the entries

remote swallow
#

for (String key : config.getConfigurationSection("path") { sysout.(key) }

tardy delta
#

then gets its value using config.getString(valLoopingOver")

#

i forgot actually

naive bolt
remote swallow
#

oh sorry

tardy delta
#

i believe im talking about getKeys(false)

#

use mine

remote swallow
#

yeah

#

for (String key : config.getConfigurationSection("path").getKeys(false)) { sysout.(key) } if you want my one

naive bolt
#

Thanks guys

#

Much appreciated

crimson jasper
#

I have yet to find a good solution for putting subcommands into their own classes. Anybody who can lead me somewhere?

remote swallow
#

it depeneds

wary topaz
#

https://paste.md-5.net/cocugurezo.java

Caused by: java.lang.NullPointerException: Cannot invoke "org.bukkit.configuration.ConfigurationSection.getKeys(boolean)" because the return value of "org.bukkit.configuration.file.FileConfiguration.getConfigurationSection(String)" is null
        at BetterServer.commands.Homes.onTabComplete(Homes.java:229) ~[?:?]

Idk why it's null though, i created the file..

remote swallow
#

now something doesnt add up

#

im gonna say its because of the load method

wary topaz
#

what should I do?

remote swallow
#

one moment

#

change it to look like

File motdConfigFile = new File(plugin.getDataFolder(), "motd.yml");
        if (!motdConfigFile.exists()) {
            motdConfigFile.getParentFile().mkdirs();
            plugin.saveResource("motd.yml", false);
            Bukkit.getConsoleSender().sendMessage("§4§lCould not save the file, is it being used by something?");
        }
        try {
            motdConfig.load(motdConfigFile);
        } catch (IOException | InvalidConfigurationException e) {
            e.printStackTrace();
            Bukkit.getConsoleSender().sendMessage("§4§lAn error occurred while reading your motd.yml file, if you need help just join our discord with /betterserver help!");
        }
#

replacing it to work with the correct vars ofc

wary topaz
#

oh lol

#

ill try it

#

at java.lang.Thread.run(Thread.java:833) [?:?]
Caused by: java.lang.NullPointerException: Cannot invoke "org.bukkit.configuration.ConfigurationSection.getKeys(boolean)" because the return value of "org.bukkit.configuration.file.FileConfiguration.getConfigurationSection(String)" is null
at BetterServer.commands.Homes.onCommand(Homes.java:70) ~[?:?]
at org.bukkit.command.PluginCommand.execute(PluginCommand.java:45) ~[spigot-api-1.19.2-R0.1-SNAPSHOT.jar:?]
... 23 more

remote swallow
#

is the config section null or not exist

wary topaz
#

its null

#

but it has all the contents which dont make sense

remote swallow
#

?paste the new file

undone axleBOT
wary topaz
#

maybe its my tab completer

#

it says line 228 is null

#

which doesnt make sense

remote swallow
#

have you ran the command without tab complete

#

oh wait

wary topaz
#

when i do that it says line 88 is null

delicate lynx
#

what does the config section look like

wary topaz
#

yaml

remote swallow
#

epic code block fail?

delicate lynx
#

show us the actual file

wary topaz
#

yeah I think i found line 88 issue

remote swallow
#

the config section is null because theres nothing there

wary topaz
#

but that doesnt make sense for the tab completer

remote swallow
#

add a home and it wont be null

remote swallow
#

so errors out

#

also use StringUtil.copyPartialMatches

#

bukkit class

#

return StringUtil.copyPartialMatches(args[num], gethomes, new ArrayList<>()):

wary topaz
#

gethomes?

remote swallow
wary topaz
#

args?

remote swallow
#

its on your tab complete method

#

starts at 0

#

.length starts at 1

delicate lynx
#

probably should see if the section even exists before randomly trying to access it

wary topaz
#

what should I replace num with

remote swallow
#

the arg number

#

starts at 0

#

/comand arg0 arg1 arg2

#

args.length starts at 1, args[] starts at 0

hazy parrot
#

thanks C and pointers for it

humble tulip
#

args is never empty in tabcompleter

#

It always has atleast 1 arg

delicate lynx
#

interesting, I didn't know that

#

I guess that makes sense actually

remote swallow
#

it isnt tab completer if there isnt atleast 1 arg technically

mystic terrace
#

Hello! I made an update checker but doesn't works... Anyone knows why?

public class UpdateChecker
{
    private SimpleSetSpawn plugin;
    private int resourceId;

    public UpdateChecker(SimpleSetSpawn plugin, int resourceId) {
        this.plugin = plugin;
        this.resourceId = resourceId;
    }

    public void getLatestVersion(Consumer<String> consumer) {
        Bukkit.getScheduler().runTaskAsynchronously(this.plugin, () -> {
            try (InputStream inputStream = new URL("https:/api.spigotmc.org/legacy/update.php?resource=" + this.resourceId).openStream(); Scanner scanner = new Scanner(inputStream)) {
                if (scanner.hasNext()) {
                    consumer.accept(scanner.next());
                }
            } catch (IOException exception) {
                this.plugin.getLogger().info(plugin.name + ChatColor.RED + " Cannot look for updates: " + exception.getMessage());
            }
        });
    }
}
#

Main class:

public void updateChecker(){
        new UpdateChecker(this, 106488).getLatestVersion(version -> {
            if (this.getDescription().getVersion().equalsIgnoreCase(version)) {
                Bukkit.getConsoleSender().sendMessage(name + ChatColor.GREEN + " It's up to date (Running version: " + ChatColor.WHITE +  version + ")");
            }else{
                Bukkit.getConsoleSender().sendMessage(name + ChatColor.RED + " You are running an old version of the plugin, please update to the latest version.");
            }
        });
    }
tardy delta
#

?notworking

undone axleBOT
#

"Does not working" is a useless statement. Please describe what exactly is not working, what you expect it to do, and what actually happens. If you get any console errors, also ?paste the entire stacktrace.

mystic terrace
#

"Please describe what exactly is not working" ok so basically it's not checking if there's any available versiom.

remote swallow
#

errors?

mystic terrace
#

No errors

#

No errors in the log just it's not running for some reason.

hazy parrot
#

is scanner.hasNext true ?

tardy delta
#

scanner::hasNext doesnt trigger ig

wary topaz
#

https://paste.md-5.net/vorunizugi.java
/home and /homes are just not returning anything (no errors either) anyone know why? also i tested it and my tabcompleter does work so i didnt have to modify that

remote swallow
#

any errors

wary topaz
#

nope

remote swallow
#

sysout in points in the code then

#

see whats happening

#

bukkit.broadcastMessage better

delicate lynx
#

write the outputs to a file instead

mystic terrace
#

I think the problem it's it marks like a //comment

hazy parrot
#

What

remote swallow
remote swallow
mystic terrace
#

oops

delicate lynx
#

if it was a comment it would remove everything after that

remote swallow
#

/* */

mystic terrace
#

It gaves me this output

#

the exception basically it's "Invalid resource"

remote swallow
#

the resource id isnt valid then

mystic terrace
#

I don't understand

remote swallow
#

whats the plugin

mystic terrace
remote swallow
#

?paste the full class with the update checker in

undone axleBOT
mystic terrace
zealous scroll
remote swallow
remote swallow
#

i mean at the top of the getLatestVersion method

#

System.out.println(String.valueOf(resourceId)):

wary harness
#

got problem with this code

#

holder.getViewer().getOpenInventory().getBottomInventory().removeItem(targetedItem);

#

targetedItem is itemStack amount of 10

#

but for example my whole item stack get's removed

remote swallow
#

iirc it just removes the item not checking for size

wary harness
#

is there way to remove proper amount

#

hm

hazy parrot
wary harness
#

I am doing shop so I am trying to check whole item for unstack items

#

and remove specific amount

mystic terrace
#

same problem @remote swallow

#

oh

#

ffs

#

I realise

#

was a very dumb thing

#

lul

#

i feel so dumb

#

xd

hazy parrot
mystic terrace
#

Okey, so basically

#

I was getting the resource ID twice

#
try (InputStream inputStream = new URL("https://api.spigotmc.org/legacy/update.php?resource=106488" + this.resourceId).openStream();
#

so I just removed the 106488 from the URL

#

Now it's working perfectly

hazy parrot
#

Oh, then 503 shouldn't really be right response for that

#

Probably 404

#

Is api part of spigot on github?

remote swallow
#

i think it is

mystic terrace
#

spigot

remote swallow
#

only 8 years out of date

#

its on stash probably

mystic terrace
#

The error message that I send it's because I didn't updated the resource and I have the new one xD

vocal cloud
#

Just use GitHub thonk

hazy parrot
#

tag_name supremacy

delicate lynx
#

github api supremacy

trim lake
#

Is there way how can I disable learning recipes for player naturally?

#

I tried HumanEntity#hasDiscoveredRecipe, but there is no way (at least i didn't find) to give player recipe.

gray merlin
#

How do I delete an entity in its entirety?

#

For instance, chest boats. When I do .remove() on one, it drops the items instead of deleting itself as a whole

remote swallow
#

try setting the health to 0

gray merlin
#

I can't really do that to boats

bold oak
#

Does anyone know how to cancel a packet from being sent to client by bungee?

vocal cloud
#

Which packet and why

bold oak
#

Respawn so that the loading world screen doesnt show when changing servers

fresh timber
#

in a for loop, can I get the number of times the loop has executed?

remote swallow
#
int i = 0; // This is the amount of times ran
for (Object o : object[]) {
  i++
  code
}
fresh timber
#

ahh ok

mystic terrace
#

How long takes spigot to update the api, becsause this one stills on the old version and I actually posted the new one

mystic terrace
vocal cloud
#

That's fine there's always room to learn

mystic terrace
#

So basically spigot api takes a lot to update right?

zealous scroll
#

Does anyone know how to properly render a default map in a MapView

#

Or make the default renderer render the whole map and not just what's explored

wheat inlet
#

idk if this right channel but when I define a __global region with worldguard is global for every world in the server or just the world i am in?

remote swallow
#

just that world iirc

oblique wigeon
#

I'm woking on a custom crafting system, and need to listen for when an Item is crafted. Would the proper way to do this be to listen for something like CraftItemEvent, or instead listen to InventoryClickEvent, and just check if it's a crafting inventory and the result slot has been clicked?

oblique wigeon
#

or is the description wrong

remote swallow
#

what do you need the event for

oblique wigeon
#

and need to subtract the correct amounts of items when the user crafts the item into the result

remote swallow
#

probably inventory click event

oblique wigeon
#

thank you!

humble tulip
#

Is there any design pattern that would force subclasses to have an empty constructor?

vocal cloud
#

Why would you want that?

humble tulip
#

trying to make a cool util to insert/get objects to/from sql databases

vocal cloud
#

But why would forcing subclasses to have empty constructors solve this?

humble tulip
#

but i have no way to guarantee i can create an instance of the class with reflection if i cant guarantee an empty cosntructor

#

this is probably an x y problem

#

where i'm going abt it wrong

vital yacht
#

Just add it to the documentation

#

Most libraries throw an error if that happens

#

At least that I know of

humble tulip
#

makes sense

#

spigot throws an error as well

#

so it's fine ig

vocal cloud
#

Yup. Throw an error and wherever the error materializes add some documentation.

humble tulip
#

btw for basics, are any other annotations needed to mark fields?

vital yacht
#

I would probably default to @NotNull but I guess that's a design choice

humble tulip
vital yacht
#

Well in your screenshot you have @NotNull

humble tulip
#

oops

#

i meant for sql not null must be set, it's not the default

#

you can put null values unless otherwise specified

vital yacht
worldly ingot
#

I was going to say. Not null as default would be different from what SQL actually does

granite burrow
#

I have probably a really stupid question, but if I run an event from my plugin would another plugin
(that has no correlation with my plugin other than being on the same server)
be able to use the event?

azure gate
#
                        if (enteredxp <= player.getExp()) {
                            player.sendMessage(InfoKeeper.getInfoKeeper(player, InfoKeeper.successfulWithdraw, enteredxp, (int) player.getExp()));
                            ExpBottleHandler.giveExpBottle(player, enteredxp);
                            ExpBottleHandler.removePlayerExp(player, enteredxp);
                        } else {
                            player.sendMessage(InfoKeeper.getInfoKeeper(player, InfoKeeper.notEnoughXp, enteredxp, (int) player.getExp()));
                        }```
#

whats is the issue here . i am having 400 xp and i am trying to withdraw 100 xp it shows i dont have enough xp

kindred valley
#

Decreasing the xp of a player?

azure gate
# kindred valley What are you actually trying to do here

i have a command /myxp 100. here 100 willis args[0] so i want to validate the sentence like . if args[0] is less than my current xp then xp bottle will be given and 100 xp will be removed from user given else message will be sended to user.

kindred valley
#

Any errora?

azure gate
kindred valley
#

Have you debugged the ifs?

azure gate
#

it show i dont have enough xp even i have xp

kindred valley
#

Is it entering the first if

azure gate
#

and my xp level is 108

kindred valley
#

multiply your xp by 135 and try again

#

Like if(enteredxp <= (player.getExp() * 135) { //Stuff }

azure gate
kindred valley
#

if your xp level is not enough, the xp number that is determined is probably a simplified version of the number that should look normal.

#

And to make 0.8 ,, 108.0, you need to multiply it with 135

#

And cast the xp to integer

azure gate
#

letrs try

#

not working

kindred valley
#

What is the xp

#

Of the player now

azure gate
#

my xp level is 900

#

the valuw whoch i get from player.getExp() is 0.11332158

kindred valley
#

Are you multiplying the value right?

#

How the fuck 0.8 * 135 is 0.1

azure gate
#

its weird

#

i want to get user xp point in game from spigot that also i cant get

kind hatch
kind hatch
# azure gate i want to get user xp point in game from spigot that also i cant get

You might want to use Player#getTotalExperience() instead of Player#getExp() then. The latter method is to get the experience of your current level. This is what is reflected on your XP bar.

If you go with the former method, keep in mind that this method will be effected by everything that gives xp. It might also reset to 0 when players die. So unless you have systems in place to prevent this, you might run into some issues.

#

Actually, now that I think about this, that might not be ideal either.

#

If you are wanting to take xp from the player, you'll have to follow the same math that is used for normal experience.

#

Which varies based on what level you are.

#

So you're going to have to calculate their total xp based on their level and then subtract the proper amount.

azure gate
#

okok

spare prism
#

?paste

undone axleBOT
ruby pebble
#

When spawning an armor stand on a placed block, can I have the armor stand facing the player in the opposite direction, i.e. a full block at the player? I've been trying for a long time, I couldn't manage

twin venture
#

hi guys , iam having very stupid problem ..
as you can see , lore is not line by line .. that's mistake ..

#

this is the code :

#

i want it to be line , under line

kind hatch
twin venture
kind hatch
twin venture
kind hatch
#

Where does that list actually get set to the itemstack?

twin venture
#

i need to go eating

kind hatch
#

Well, it looks like you're somehow applying it wrong. Where do you make that specific itemstack?

grand coral
#
[09:44:21 ERROR]:               com.mysql.cj.jdbc.result.ResultSetFactory.<init>(ResultSetFactory.java:61)
[09:44:21 ERROR]:               com.mysql.cj.jdbc.StatementImpl.<init>(StatementImpl.java:259)
[09:44:21 ERROR]:               com.mysql.cj.jdbc.ConnectionImpl.createStatement(ConnectionImpl.java:1089)
[09:44:21 ERROR]:               com.mysql.cj.jdbc.ConnectionImpl.createStatement(ConnectionImpl.java:1083)
[09:44:21 ERROR]:               CoinAPI-1.0-SNAPSHOT.jar//de.dark.coinapi.utils.MySQL.executeQuery(MySQL.java:70)
[09:44:21 ERROR]:               CoinAPI-1.0-SNAPSHOT.jar//de.dark.coinapi.utils.Coins.getCoins(Coins.java:94)
[09:44:21 ERROR]:               CoinAPI-1.0-SNAPSHOT.jar//de.dark.coinapi.vault.EconomyProvider.getBalance(EconomyProvider.java:50)
[09:44:21 ERROR]:               tablist-lp-1.0-SNAPSHOT (2).jar//net.milkbowl.vault.economy.AbstractEconomy.getBalance(AbstractEconomy.java:20)
[09:44:21 ERROR]:               RealScoreboard.jar//josegamerpt.realscoreboard.utils.Placeholders.money(Placeholders.java:140)
[09:44:21 ERROR]:               RealScoreboard.jar//josegamerpt.realscoreboard.utils.Placeholders.setPlaceHolders(Placeholders.java:193)
[09:44:21 ERROR]:               RealScoreboard.jar//josegamerpt.realscoreboard.scoreboard.ScoreboardTask.lambda$run$0(ScoreboardTask.java:53)
[09:44:21 ERROR]:               RealScoreboard.jar//josegamerpt.realscoreboard.scoreboard.ScoreboardTask$$Lambda$8909/0x00000008024a4458.apply(Unknown Source)```
#

Can anyone say me why the Server is crashing? Is it because of the mysql query execute or what is the problem?

kind hatch
# twin venture

I'm not gonna lie. I have no idea what I'm looking at here.

twin venture
#

its the gui

#

class

#

this is the the Quest interface :

wary topaz
#

is there a way to set the motd to default? (serverpinglistener)
event.setServerIcon(default <-- here);

twin venture
#

and in abstract quest this :

kind hatch
# twin venture

Look, setting itemstack lore is as simple as this.

List<String> lore = //whatever your list is.

ItemStack item = new ItemStack();
ItemMeta meta = item.getItemMeta();
meta.setLore(lore);
item.setItemMeta(meta);
rose ibex
#

Hi

twin venture
#

and in the gui i just do this :

rose ibex
#

when i start my server test the plugin have problem whit the main class

wary topaz
#

?paste your code @rose ibex

undone axleBOT
twin venture
wary topaz
#

(he deleted his image)

kind hatch
rose ibex
#

is not intellj in the image

kind hatch
wary topaz
#

...

#

You got to learn to read error messages

kind hatch
rose ibex
wary topaz
#

delete SimplePluginManager, it is stopping the error message from continuing

#

than reload

kind hatch
# twin venture

What does your InventoryDesignConfigKeys.VALUE.getStringList() method do?

#

Cause that looks like where your issue would be.

kind hatch
twin venture
kind hatch
wary topaz
rose ibex
#

thx

wary topaz
#

thats his image

tardy delta
#

no need to check both contains and then splitting

#

its looping twice

wary topaz
tardy delta
#

just check split.length

#

just put the right link to your main class in your plugin.yml

kind hatch
#

^

#

@rose ibex

rose ibex
#

yes

tardy delta
#

show your project structure

#

?img

undone axleBOT
twin venture
wary topaz
#

tf is a filled_map

rose ibex
kind hatch
rose ibex
#

yes

tardy delta
#

why solarcore.solarcore 🤔

wary topaz
#

pom.xml @rose ibex

rose ibex
#

ok

kind hatch
#

?paste your pom

undone axleBOT
tardy delta
#

what does that have to do with it

wary topaz
rose ibex
kind hatch
kind hatch
# rose ibex https://paste.md-5.net/eyogixerog.xml

Your pom looks fine, but in all honestly, you don't need the plugins section. Intellij will use it's local version of maven to compile for you.
Your file structure also looks fine and if your main class extends JavaPlugin, then maybe you didn't copy the file over to the server properly. It happens sometimes. Try recompiling it and see if you still have an issue.

wary topaz
kind hatch
#

Wdym to the default?

wary topaz
kind hatch
#

Idk, maybe pass in null? That image is provided when there is no server icon found.

wary topaz
#

when i do null crazy shit happens

rose ibex
#

is this right?

wary topaz
#

delete that and ?paste

#

?paste

undone axleBOT
kind hatch
#

Looks fine to me.

rose ibex
rose ibex
kind hatch
# wary topaz

You might have to send packets. I think the server image is cached locally on your machine, so you'd have to make the client think that it isn't there.

wary topaz
#

how tf..?

kind hatch
#

Have you not noticed how when you launch the game and go to the multiplayer list, the server icons are still there?

#

The icons are cached somewhere locally.

wary topaz
#

yea

kind hatch
#

So maybe a packet can tell the client that it's no longer necessary to keep that cached icon since it's no longer on the server.

#

It looks like if the server-icon file is removed, it is relayed to the client somehow.

#

You'll probably want to look into the server ping packets as that's when the icon is updated.

#

@wary topaz Looks like there is a packet field you can use.

#

Only problem is that you'll also have to send the MOTD as well.

#

This is 1.19 NMS not 1.19.2

#

But, you can send a null icon.

twilit roost
#

Sup guys
I have made NEAT ( Machine Learning )
But I don't know how to hook it up to Minecraft Plugin.

Im creating Anti Auto Clicker.
Any clues how should I rate different clients in NEAT?

tardy delta
kind hatch
#

Constructor params aren't optional though. :/

kind hatch
twin venture
#

anyone know a fix for this kind of problems?

#

iam getting the quest Lore , and set it ..

kind hatch
# twin venture

You're problem is right here. You are trying to concat a list of strings into a string variable, so the #toString() method gets called instead.

rose ibex
civic zenith
#

can someone help me devlop a lifesteal server please

#

please join genral 1

kind hatch
rose ibex
#

same

twin venture
#

something like this might fix it ?

#

or am i wrong

kind hatch
twin venture
#

this is the how the config looks like :

glossy venture
#

if your description is already split by line just return that

twin venture
#

so for each quest i set the value for lore like this :

civic zenith
#

can someone help me devlop a lifesteal server please
please join genral 1
I pay him 8 dollars / 2 hour

twin venture
kind hatch
rose ibex
civic zenith
rose ibex
#

it was in the plugin.yml

civic zenith
glossy venture
#

if the description is already split by newlines just return that
otherwise use something like

public List<String> getLore(Quest<?> quest) {
  // create output list
  List<String> lore = new ArrayList<>();
  // for each line in description
  for (String ln : quest.getDescription()) {
    // split the line by \n (newline)
    // and add the lines to the output list
    lore.addAll(Arrays.asList(ln.split("\n")));
  }
  // return output lore
  return lore;
}
kind hatch
#

ItemMeta takes care of new lines so long as you provide a List<String> to the #setLore() method.

glossy venture
#

ah

glossy venture
twin venture
#

thank you !

kind hatch
#

Either that or thats the output of a List<String>#toString()

tardy delta
onyx fjord
#

is it safe to do stuff with particles async?

glossy venture
twin venture
#

its multi line ..

#

but iam adding it in the config

#

that is the default

tardy delta
#

some of them are

kind hatch
twin venture
#

nop still

tardy delta
#

impl is terrible

#

safelyAdd what a bs

glossy venture
kind hatch
# glossy venture i dont see that

I'm certain it does though. At least that's how it's rendered in game. I don't put \n at the end of any of my messages in my lore.

glossy venture
#

no i know

twin venture
#

maybe problem from this?

glossy venture
#

i thought you meant it splits by \n

#

automatically

tardy delta
#

i mean wtf

glossy venture
onyx fjord
#

i do have code for that tho i never used it

quaint mantle
#

hi guys, does anybody know a simple way i can create a folder inside the plugin folder and create a file inside of it ? i am running an http server in the plugin so i need a folder to put the html css and js files in, thanks :D

onyx fjord
#

Arrays.asList(STRING.split("\\\\n"))

#

lmao

twin venture
tardy delta
#

public void bedwars

#

dont laugh

twin venture
#

xd

glossy venture
kind hatch
# glossy venture i thought you meant it splits by `\n`

I think we are getting at the same thing.

List<String> lore = Arrays.asList("Line 1", "Line 2", "Line 3");

ItemStack item = new ItemStack(Material.RED_BED);
ItemMeta meta = item.getItemMeta();
meta.setLore(lore);
item.setItemMeta(meta);

That will return an item with 3 lines of lore.

twin venture
glossy venture
#

bruh

#

give the code of the one it calls

onyx fjord
#

ij just says fuck you when i paste it

glossy venture
#

in paste

twin venture
#

welp it already have /n

#

i just noticed xd

#

i think problem from here ?

#

this is the lore for each quest

onyx fjord
#

its just like "im gonna do 4 slashes anyway fool"

twin venture
#

and for each quest , challenge i add the lore like this :

glossy venture
#

its giving a warning as well

#

show the warning

#

on split("\n")

twin venture
#

//n ?

glossy venture
#

the \n is yellow

onyx fjord
#

with one it probably just escapes?

kind hatch
onyx fjord
#

or doesnt escape sry*

glossy venture
#

it works in regexr

kind hatch
#

Although there is no point in splitting if you are working with a List<String> in the first place.

#

That codebase is a mess to read.

#

It took me a while to find that he was concating a string list with a string.

glossy venture
twin venture
#

😳

kind hatch
#

Sure, but in this case, we are talking itemstack lore. There isn't a point in using \n because the newlines are handled if you provide a List<String>

glossy venture
#

yes but in the config for convenience or something i dont know you might want to use \n

twin venture
#

ok so other lore works fine like this :

#

and iam doing same thing

kind hatch
hazy parrot
#

Or just use yaml provided multiline

kind hatch
gleaming grove
#

What is the most reliable way to store Class instance inside ItemStack? Class structure might be changed with plugin updates so serialize Object to byte[] is not an option. For now I consider serialize class to JSON or Dictionary<String, Object> and then save it with PersistentDataType.BYTE_ARRAY to itemstack. What do you think?

kind hatch
hazy parrot
twin venture
#

anyway , this is how iam setting lore for each quest :

kind hatch
onyx fjord
hazy parrot
onyx fjord
#

end user will be confused with such format

#

the simpler the better

hazy parrot
#

¯_(ツ)_/¯

onyx fjord
#

when you develop stuff configurable by end user you gotta put yourself in mind of average end user with no programming knowledge or just no yaml knowledge

#

wow thats my longest sentence of the day

eternal oxide
#

Good advice. If they can break it they will.

twin venture
#

so what i can do to fix it ?

tardy delta
#

average plugin dev: their problem

twin venture
#

i must remake the system on how to set the lore xd?

onyx fjord
radiant aspen
#

Greetings fellow humans,

Anyone know what event it is to prevent blocks from growing? such as skulk moss, trees ect

I want to avoid the blocks growing into certain areas

tardy delta
#
  1. dont have github
onyx fjord
#
  1. theyll jump to your discord then
tardy delta
#
  1. skip forum stuff
#
  1. dont have a support discord
radiant aspen
tardy delta
#
  1. go touch grass nerds
#

should talk to myself actually

kind hatch
onyx fjord
tardy delta
#

imagine having snow already

radiant aspen
#

but BlockGrowEvent doesnt have a source block

#

so if a player decides to grow a tree right on the border, the trees leaves for example could go into another persons claim right?

#

is there another event more suitable for this that anyone knows of?

kind hatch
#

Yea, but I think that's a different event.

#

StructureGrowEvent

quaint mantle
#

how do i render html css and JS in an HttpServer ?

kind hatch
radiant aspen
kind hatch
radiant aspen
#

yeah, so I just got a list of claims

#

and then im checking if the source block and block that was grown/spread is in the same claim

#

Im Currently listening to BlockPistonEvent BlockSpreadEvent and StructureGrowEvent

wet breach
# twilit roost bump

not sure why you went with machine learning to solve this. All you need is heuristics to solve a problem like auto clicking

twin venture
#

i fixed my problem :
thanks for everyone .

radiant aspen
#

if I cancel this event

#

will it stop trying to move?>

#

or will it keep trying to move and call this event frequently?

kind hatch
#

Probably the latter since water is physics based.

#

However

#

The docs say

#

So maybe it won't.

twilit roost
wet breach
#

heuristics basically works by collecting data such as measuring your users clicks. How fast they click in a given period, how long they click and how many times. This data is then used in a way you can compare to see if they are using an auto clicker because the data from an autoclicker would be outside of this range of what is normal

#

and the best part is the more data your heuristics has, the more accurate it becomes 🙂

twilit roost
#

oooh tysm
but what about Auto Clicker with random offset?
will it go thru?

kind hatch
#

That'd just be another set of data.

wet breach
#

it can catch such things, basically if you have a decent enough data for your heuristics approach it is almost impossible to use an auto clicker better then a human can do it lmao

twilit roost
#

ohhh that's cool

#

some possibilities of false positive?

kind hatch
#

Always, no solution is perfect and there will always be exceptions, but if it can detect 99% of people, that's probably as good as it'll get.

tardy delta
#

love it when some cases work and others dont

twin venture
#

ok now the lore dissapered

#

gg

#

rewards part just dissapered :

remote swallow
#

on replaceLore you are only returning 1 string out of that lore

twilit roost
# wet breach it can catch such things, basically if you have a decent enough data for your he...

I watched some videos of heuristics
but all of them are Pathfinding solutions

even website mention it as Pathfinding
https://www.tutorialandexample.com/informed-search-heuristic-search

#
  • or I think its pathfinding
twin venture
#

but it worked .. now it dosen't work

#

but i lose the other values ..

#

other values don't show

remote swallow
#

are you using replaceLore on that lore value

twin venture
#

no only desciription lore

#

oh i see the problem

remote swallow
#

theres why, on anywhere you use replaceLore you will only get 1 of the strings out of that string list

twin venture
#

it only give the first line of lore

remote swallow
#

yeah

twin venture
#

how i can fix that?

#

xd

#

if i only do descirioption

#

if i use this , it will not work

#

bcz it will show side by side

#

i mean the lore

#

"this is lore " ,"";

remote swallow
#

?paste that method so its easier to read

undone axleBOT
remote swallow
#

the lore one if (questi.isSomething)

twin venture
#

i dont quite follow xd?

#

what do you mean

remote swallow
#

ive got it

twin venture
#

ok

remote swallow
#

one problem you'll have is your setting the lore to the description, then settng it to quest lore

#

over writing the description lore

#

ill write somethig for you one moment

neat harbor
#

Hi, so I don't know if this makes sense but my PlayerJoinEvent code gets called from someone leaving? It then starts calling it ALOT like, just calling it infinetely -> (https://sourceb.in/ksQKAcUdb7), it starts spamming the rejoin message from -> (https://sourceb.in/5eNWEuCuCA). The result of this is that in the console you literally cant type "stop" and you just have to end the process manually. (It just spams "'s frozen screen has been re-applied (They left)")... This can happen if they get kicked etc; If you need any more code (Like my main class). Just say!

twin venture
#

ok 1 part is fixed , other part is not ..

#

rewards part fixed , but the old part is broken xd

summer scroll
#

And set the lore just once.

remote swallow
# remote swallow ill write somethig for you one moment
List<String> lore = new ArrayList<>();
if (quest.isChallenge()) {
  for (String descriptionLine: description) {
    lore.add(InventoryDesignConfigKeys.CHALLENGE_GUI_ITEM_LORE.getStringList().replace("challenge-description", ChatColor.GRAY + descriptionLine)
  }
  lore.add(InventoryDesignConfigKeys.CHALLENGE_GUI_ITEM_LORE.getStringList().replace("challenges-remaning", questUserData.getCurrentValue())
twin venture
#

there is quests , challenges

remote swallow
#

change that for the right situation

summer scroll
twin venture
wet breach
summer scroll
wet breach
#

so you would collect stats on, how long players click for, how many times they click in a given time and so forth. You would then use this data as a comparison in detecting an auto-clicker because an auto-clickers data would be outside of what you have that is considered normal

#

there isn't a specific way to collect heuristics or how to implement it. But the more data points you have the more accurate it is and the more data you collect as well

neat harbor
wet breach
hybrid spoke
civic wind
#

Anyone know how to change a block that's fallen once its landed?

#

Tried numerous ways none work

hybrid spoke
#

there are so many scenarios and its very hard to not false positive

civic wind
wet breach
hybrid spoke
#

especially in minecraft where you dont receive the actual clicks but only the results

wet breach
hybrid spoke
#

the only stuff where i think of could work are patterns or like the offets the crosshair does while clicking high frequently

wet breach
hybrid spoke
hybrid spoke
#

and with that, in autoclicking you cant be sure whats legit or not

wet breach
hybrid spoke
#

so players could just raise your upper bounds up

wet breach
neat harbor
#

Hi, so I don't know if this makes sense but my PlayerJoinEvent code gets called from someone leaving? It then starts calling it ALOT like, just calling it infinetely -> (https://sourceb.in/ksQKAcUdb7), it starts spamming the rejoin message from -> (https://sourceb.in/5eNWEuCuCA). The result of this is that in the console you literally cant type "stop" and you just have to end the process manually. (It just spams "'s frozen screen has been re-applied (They left)")... This can happen if they get kicked etc; If you need any more code (Like my main class). Just say!

hybrid spoke
#

saw people click 70+ cps legit

summer scroll
# civic wind

I think you need to track where the block will be landed.

hybrid spoke
#

i mean you can cut at 100

#

but that wont stop the most autoclickers

twin venture
#

hhhhhhhhh

twin venture
#

its readding the lore

civic wind
#

isonground checks for when it lands

#

not sure it matters where

twin venture
wet breach
hybrid spoke
#

i mean yeah. you shouldnt only concentrate on the clicks itself, but on the timings between

#

you can do so much with that

civic wind
#

Can't lie there should be another text channel for people discussing things about development

wet breach
#

but once you have a decent enough size of heuristics though it becomes harder and harder for an auto-clicker to hide itself

civic wind
#

ty

hybrid spoke
wet breach
#

because your heuristics is based on human players in what they can and can't do, and while yes you will have edge cases like some players capable of doing more, you won't have that many because most players are not capable of this

hybrid spoke
#

on the CPS? timings? averages? patterns?

wet breach
#

you would compare everything you could

#

if the data you are comparing starts going out of bounds then you know they most likely are either using an auto-clicker

#

for instance, timing is a good way to know

#

humans can only click so fast as well as the time between their clicks and how many

#

but then you could compare to what they are doing

#

are they moving? or are they standing still etc

twin venture
hybrid spoke
#

easier said than done

twin venture
hybrid spoke
#

there can and will be so much going wrong

wet breach
hybrid spoke
#

that will take time and effort

#

once you're done its useless

wet breach
#

as do most things lol

summer scroll
wet breach
# hybrid spoke once you're done its useless

it isn't useless, most of the best anti-cheat software out there uses heuristics to measure what is known to be impossible as well as what is not typical. You will get some false positives but when that happens its up to whoever to determine what to do in those cases

#

as I said, not everyone is some pro player

twin venture
summer scroll
twin venture
#

alr i see now

#

so i need to add them only 1 time

wet breach
#

@hybrid spoke I don't know how to explain it any better. Heuristics isn't something to be perfect.

hybrid spoke
hybrid spoke
#

there would be so much things to check for and keep care of

wet breach
hybrid spoke
#

yeah, thats more or less what my anti auto clicker is doing for example

#

but in that case the best i could come up with is to let the plugin do some analytics and suggest the owners a change of the config values

wet breach
#

unfortunately in the realms of anti-cheat stuff or the related you can't really do a whole lot in regards to edge cases except either flag them or ignore them as edge cases. The best you could do is instead of relying on a dynamic boundary is to artificially create a hard set one

hybrid spoke
#

yeah thats what i have, given to the server owners

#

and settings to adjust each check

wet breach
#

personally I am not against auto-clickers in themselves though, I have combated them but for me it wasn't all that hard because I only cared in where they were used

hybrid spoke
#

to use an auto clicker right is also a skill lol

wet breach
#

I didn't care if people used an auto-clicker for some farm stuff

hybrid spoke
#

you can perma click and be defeated by one-clickers

wet breach
#

but if they used it in combat and the related though it was easy to pick up

hybrid spoke
#

but its annoying in like bedwars or stuff

#

when they just godbridge above the whole map

wet breach
#

lol

hybrid spoke
#

thats what i miss nowadays

#

the noobibridging without letting go of shift

wet breach
#

the only other decent systems in regards to this would be to simulate the actions of the players on another server where you can watch it

#

as in rewind or go forward etc

quasi sundial
#

If I want to place like a schematic/specific prebuilt structure, how would I do that?

hybrid spoke
#

so basically a replay system

wet breach
#

and then see if what they were doing was even realistically possible

wet breach
hybrid spoke
#

but to connect that with an anti auto clicker can be memory heavy

#

since that will just save every little flag lol

wet breach
#

oh definitely

#

someone here can't remember who made a decent replay system

hybrid spoke
#

only heard good about it

wet breach
#

that wasn't it

#

the person is a long time member of spigot, just can't remember which it was

#

as they haven't really talked here in a while

#

basically it would save all the packets, and then on another server replay those packets

#

and then you could watch the player or players to see what they were doing and at what time

#

in this manner you were free to look at everything in any view you wanted

hybrid spoke
wet breach
#

except it uses protocollib

hybrid spoke
#

but i imagine that to be cool

#

imagine you pause the replay and a bunch of stats appear next to every player

#

with their recent cps

#

patterns

#

averages

#

etc.

wet breach
#

only you didn't need to stop anything, it was just displaying the information you wanted displayed

#

or that it could

#

but it was handy though to stop the action

#

and the only resource intensive thing was just the replay server, saving the packets overall wasn't all that space consuming

#

it was cool nonetheless, at some point I will check out that plugin but that isn't the one I was referring to but maybe it can become just as cool too? lol

hybrid spoke
#

if you can hook into it and inject your own stats that would be cool for my AAC

#

feel free to ping me once you found it

twin venture
#

finally fixed all errors .. 🙂

vocal cloud
#

Bed Wasrs experience and title has 2 quests in it

wet breach
vocal cloud
#

Other than that 10/10

twin venture
wet breach
twin venture
#

its configurable from a config file so i can easly delete the second Quest ..

wet breach
#

however maybe I could re-create such a system though

neat harbor
#

Hi, so I don't know if this makes sense but my PlayerJoinEvent code gets called from someone leaving? It then starts calling it ALOT like, just calling it infinetely -> (https://sourceb.in/ksQKAcUdb7), it starts spamming the rejoin message from -> (https://sourceb.in/5eNWEuCuCA). The result of this is that in the console you literally cant type "stop" and you just have to end the process manually. (It just spams "'s frozen screen has been re-applied (They left)")... This can happen if they get kicked etc; If you need any more code (Like my main class). Just say!

wet breach
#

why is it you don't listen for players leaving?

neat harbor
#

Because I listen for them to join to the re-open a window on them

#

The issue isn’t them leaving it’s the fact that when they leave for some reason it spam calls the PlayerJoinEvent

wet breach
#

because you have a task running in there, but you never listen for them leaving....

#

thus you never remove them from some lists

neat harbor
#

Their UUID needs to remain on the only hash map they are needed on so I can check if they should have a window on them

#

I have (off the top of my head) no other lists

wet breach
#

you still need to listen for them leaving or should....

#
onPlayerQuit(playerquitevent event) {
//do some cleanup
}
neat harbor
#

Hmmm, ok.

wet breach
#

if a player quits with an inventory opened

#

the server never gets a packet that they closed an iventory

neat harbor
#

Ah

#

Oh ok that makes sense

wet breach
#

so the logic for your quitevent listener

#

is to instead count that as also closing the inventory

#

and clear them out of any lists that are necessary lol

neat harbor
#

Erm

wet breach
#

just remember when the player leaves, player object becomes stale

neat harbor
#

So the window is opened to stop them from destroying a ghost client etc so it needs to be re-opened when they shut it

#

So I have a hash map so that I store the UUID with a Boolean attached

#

That Boolean is whether they should have a window open

wet breach
#

alright, well when they leave probably shouldn't be trying to re-open windows on non-existent players lol

neat harbor
#

Yeah that’s what I think

summer scroll
#
Set<UUID>

Map<UUID, Boolean> --> big no no
civic wind
#

?paste

undone axleBOT
glossy venture
wet breach
#

also, you you have to iterate a set as opposed to just a hashmap

#

also, hashmap is a key value pair, which their above usage of such is valid, and a set doesn't have this assoication

worldly ingot
#

Nah, Set is far superior here because #contains()

#

There are almost zero situations where you should be using a Map<Object, Boolean>

#

Unless you want nullable booleans, in which case you need to rethink your design

tardy delta
#

there wouldnt be a way to distinguish between null and a nullable boolean then

wet breach
#

you could use contains if they are in the set, but you would need to iterate to get who is in the set. If I was to recommend on the basis of optimizing, I would go with a player wrapper and have the boolean on the custom player object itself

#

but really these are all just micro-optimizations at best. What they are doing I am sure they wouldn't really notice a difference

naive bolt
#

can i register a command at the highest level? so it overrides any other plugins?

wet breach
#

if you are needing to override plugins there is other methods to do so that doesn't require registering commands at the highest level

naive bolt
#

just wondered that event listeners you can set priorities. wondered if commands were same

wet breach
#

no they are not, basically its on a first come first serve basis in regards to command registration

#

so whoever registers it first

#

but you have other ways though to handle duplicate commands stuff

#

you can for instance allow aliasing your commands

#

if you don't care how it will affect other plugins, you could unregister other plugins commands and register your own don't really recommend this lol

#

another option is to ensure your plugin loads first so you could register the command first

#

but personally allowing your commands to easily be aliased without resorting to the bukkit alias commands would probably be a far better approach as you could allow it to be customizable

haughty idol
#

so when i use PlayerInteractEvent, and click at a block, it registers both actions, LEFT_CLICK_BLOCK and LEFT_CLICK_AIR

remote swallow
#

?interactevent

undone axleBOT
#

The PlayerInteractEvent may be called once per hand. If you only want code to be executed once, you can check the result of https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/player/PlayerInteractEvent.html#getHand(), then decide functionality.

For example, only executing code if the main hand was used:

@EventHandler
public void onPlayerInteract(PlayerInteractEvent event) {
    if (event.getHand() != EquipmentSlot.HAND) { // * if the hand used is NOT the main hand:
        return; // do not progress past this point  |
    }
    // provide functionality
}
haughty idol
#

tysm :D

haughty idol
#

uh, now it doesn't work in adventure mode

#
    @EventHandler
    public void playerMouseInput(PlayerInteractEvent event) {
        Action action = event.getAction();
        Player player = event.getPlayer();
        PlayerStats playerStats = PlayerStats.getStats(player);

        if (event.getHand() != EquipmentSlot.HAND) {
            return;
        }

        if (playerStats.spellTriggers.spellMode) {
            playerStats.spellTriggers.continueNormalSpell(action);
            return;
        }

        if (action.equals(Action.RIGHT_CLICK_BLOCK) || action.equals(Action.RIGHT_CLICK_AIR)) {
            playerStats.spellTriggers.enterSpellMode();
        }
    }
#

this is my code

remote swallow
#

== on enum values

haughty idol
#

?

#

where's the static asbuse morice?

tardy delta
#

whats this PlayerStats.getStats(player);

haughty idol
#

getting the player stats saved in config

#

that isn't static?

#

what?

#

for each player a SpellTriggers class is created

#

what should i do here?

gleaming grove
#

does spigot create new CraftPlayer objects everytime certain player joins?

#

i mean it is safe to make HashMap<Player, Object>()>

#

?

river oracle
#

don't save players to hashmap (good way to cause a memory leak)

wet breach
river oracle
#

use UUID

wet breach
#

in other words, your player object will become stale when they leave

gleaming grove
#

ok thanks

ionic dagger
#

can someone explain why i am not getting the "killed by zombie villager!!!!" message when i am killed by a zombie villager

remote swallow
#

if thats the death event the killer will only be player iirc

ionic dagger
#

Wdym?

remote swallow
#

are you using the PlayerDeathEvent

ionic dagger
#

Killer only returns player?

#

Yes

remote swallow
#

the killer can only be player from what i remember

ionic dagger
#

I see

#

What about the first if?

#

The .getType().equals

remote swallow
#

your still checking if the event killer is something which isnt a player

ionic dagger
#

O ya

#

How should I check that then?

remote swallow
#

entitydamagebyentityevent and check if the health is 0

#

then you can get the cause

#

and killer

ionic dagger
#

Wouldn’t I have the same issue w checking if a skeletons killed the player?

#

Or would the projectile trigger the byentityevent aswell

remote swallow
#

idk about projectiles