#help-development

1 messages · Page 1690 of 1

hasty prawn
#

5Head true

ivory sleet
#

Yes if a plugin performs a player to chat on the server thread then it’s going to be fired on the server thread lol

hasty prawn
#

You just said "might" so just thought it should be clarified when it's async and when it's not.

#

For normal messages from player's it's always Async so

halcyon mica
#

Any idea about the question I had?

#

using the getNavigation().moveTo() has the entity properly pathfind to the desired location, but always stops a single block before the actual target

stone sinew
halcyon mica
#

It's not stopping on the edge of a block, but in the middle of a previous block

#

But yes, it is a block position

hasty prawn
#

Can you not just make the goal 1 block further than what you want?

halcyon mica
hasty prawn
#

Then they'll stop 1 block closer than that, which is where you want.

halcyon mica
#

That's not really solving the problem, is it

hasty prawn
#

It is if they walk where you want them to go PauseChamp

halcyon mica
#

And I'd also have to determine the direction from with the entity pathfinds from

#

Which is insanely inefficient

hasty prawn
#

Do all entities stop 1 block away?

halcyon mica
#

I don't know, I can only send this debug render packet for my custom entity

hasty prawn
#

Can you change it to another mob such as a Skeleton? I'm wondering if it's using some minimum range and stopping there.

halcyon mica
#

Nope, it's not that

#

This is not a zombie anyway

#

It is just borrowing the assets from one

hasty prawn
#

Whats the underlying entity

halcyon mica
#

A custom one

stone sinew
#

Doesn't the move to path only check for the block next to because they can attack from 1 block?

hasty prawn
#

That's what I thought, hence the Skeleton suggestion.

#

It would stop further away if it had a bow Thonk

hasty jackal
#

if you're using the navigation anyway, have you checked if the generated path is already wrong? so e.g. getNavigation().getPath().getEndNode() and getNavigation().getPath().getTarget()

torn vale
#
package de.leleedits.lobbysystem.commands;

import de.leleedits.lobbysystem.util.Constants;
import org.bukkit.Bukkit;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;

public class BroadcastCommand implements CommandExecutor {
    @Override
    public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
        Player player = (Player) sender;
        if (player.hasPermission("lobbysystem.broadcast")) {
            if (command.getName().equalsIgnoreCase("broadcast")) {
                if (args.length == 1) {
                    StringBuilder stringBuilder = new StringBuilder();
                    for (int i = 0; i < args.length; i++) {
                        stringBuilder.append(args[i]).append(" ");
                    }
                    String msg = stringBuilder.toString();
                    Bukkit.broadcastMessage("§7§l[§c§lBroadcast§7§l] §a" + msg);
                } else if (args.length == 0) {
                    player.sendMessage(Constants.PREFIX + "§cPlease use §6/broadcast <MESSAGE>§c!");
                }
            }
        } else {
            player.sendMessage(Constants.PREFIX + "§cYou are now allowed to do this!");
        }
        return false;
    }
}

Why can I only use one word in my /broadcast command?

hasty jackal
#

because you check if you pass exactly one argument (aka word) : args.length == 1

torn vale
#

oh, my fault, sorry

halcyon mica
#

Open and closed set including

hasty jackal
#

ah I see

halcyon mica
#

This is a mob entity however, not a monster

#

So I see no reason why'd stop one short

hasty jackal
#

how large is the bounding box of the entity? because that's the only other thing I can see that would mess up the target location

halcyon mica
#

Espicially cause the don't actually collide when following a entity too

hasty jackal
#

ok so not particularly larger than usual

halcyon mica
#

That entity is targeting me, with the moveTo(Entity) method

#

It still stops one block short

hasty jackal
#

at least that part is consistent then

shadow night
#

Is there a way to make a client render something?

halcyon mica
#

No

#

This is a client mod that re-introduces the debug renderer for pathfinding

#

Minecraft has a dedicated plugin channel set up for it

shadow night
halcyon mica
#

Probaby

#

I am not modifying the target position, and the entity type has no influence on the pathfinding

#

So what could be the problem here

stone sinew
halcyon mica
#

That is not how that works

#

Pathfinding is far more complicated than that

stone sinew
halcyon mica
#

You know that is possibly the most simply case of pathfinding, right

#

Do you even know how MC does pathfinding

young knoll
#

I mean you could just write your own move to block goal

hasty jackal
halcyon mica
#

You people really need to learn the difference between a goal and pathfinding

#

I am explaining that like once a day

#

A goal is a thing that tells a entity where to go and what to do

#

Pathfinding is the thing that actually determines the path and makes the entity go to the spot

#

And the latter is the issue

stone sinew
tardy delta
#

and you're checking if args.lengh == 1 or 0

#

so not 2

#

as you want

quaint mantle
#

Caused by: org.gradle.api.GradleException: This version of Shadow supports Gradle 7.0+ only. Please upgrade.


Gradle 7.2

Build time: 2021-08-17 09:59:03 UTC
Revision: a773786b58bb28710e3dc96c4d1a7063628952ad

Kotlin: 1.5.21
Groovy: 3.0.8
Ant: Apache Ant(TM) version 1.10.9 compiled on September 27 2020
JVM: 1.8.0_302 (Amazon.com Inc. 25.302-b08)
OS: Windows 10 10.0 amd64

#

gradle shadow not working

#

and gradle is 7.2

tardy delta
#

ugh

halcyon mica
#

But a zombie does damage by colliding with the player

#

So I struggle to see the issue

hasty jackal
#

I've looked over the source a couple of times now but I'm having a hard time to find anything that would really make sense

#

I doubt it's skipping the last step, because getting into such a state is highly unlikely

ivory sleet
#

Also what’s not working

stone sinew
#

@halcyon mica what exactly are you trying to do?

hasty jackal
#

so the only other option is that (1) it sets the location of the last path node wrong and then (2) thinks it already reached it (or maybe not and is just stuck?)

#

but to the the path node one whole block off would require quite a large bounding box, which also isn't the case

#

I'm much more of a debugging guy but I'm not in a position to whip up a quick test case so I'm at the end of my capabilities for this one

quaint mantle
#

How can i check if a player is in a worldguard region called "safezone"? I've been searching around, but can't find a clear up to date answer

tardy delta
#
for (ProtectedRegion rg : WGBukkit.getRegionManager(p.getWorld()).getApplicableRegions(target)) {
    if (triggerRegions.contains(rg.getId().toLowerCase())) return true;
}
#

i hope its still recent

quaint mantle
#

I think it's outdated, WGBukkit doesn't seem to exist

tardy delta
#

WGPlugin?

#

ah

public static WorldGuardPlugin getWorldGuard() {
        final Plugin plugin = Bukkit.getServer().getPluginManager().getPlugin("WorldGuard");
        if (plugin == null || !(plugin instanceof WorldGuardPlugin)) {
            return null;
        }
        return (WorldGuardPlugin)plugin;
    }
quaint mantle
#

Yeah i've tried that, doesn't have a getRegionManager function

#

Found it i think

tardy delta
#

im stuggling through the spaghetti

young knoll
#

🍝

quaint mantle
#
Could not HEAD 'https://jcenter.bintray.com/org/jdom/jdom2/2.0.6/jdom2-2.0.6.pom'. Received status code 403 from server: Forbidden
Disable Gradle 'offline mode' and sync project

gradle

shadow night
#

Disable offline mode

quaint mantle
#

beep beep beep

tardy delta
#

uhh this havent found a way to make this shorter

private void teleport(Player p, String name) {
        UUID uuid = p.getUniqueId();
        if (!CommandMagmabuildnetwork.getBypassingPlayers().contains(uuid)) {
            if (uses.containsKey(uuid)) {
                if (uses.get(uuid) < 2) {
                    uses.put(uuid, uses.get(uuid) + 1);
                } else {
                    long timeLeft = System.currentTimeMillis() - cm.getCooldown(uuid);
                    if (TimeUnit.MILLISECONDS.toDays(timeLeft) < 1) {
                        Utils.message(p, "&cPlease wait&e " + Utils.millisToHumanReadable(TimeUnit.DAYS.toMillis(1) - timeLeft) + " &cbefore reusing this command!");
                        return;
                    }
                }
            } else uses.put(uuid, 1);
        }
        Location loc = getLocation(p, name);
        if (loc != null) {
            loc.getChunk();
            p.teleport(loc);
            cm.setCooldown(uuid, System.currentTimeMillis());
            Utils.message(p,"&aTeleported to " + name);
        }
    }
tardy delta
#

yes

#

i'm building pyramids

#

?paste

undone axleBOT
tardy flame
# tardy delta uhh this havent found a way to make this shorter ```java private void teleport(P...
private void teleport(Player p, String name) {
        UUID uuid = p.getUniqueId();
        
        if (!CommandMagmabuildnetwork.getBypassingPlayers().contains(uuid)) {
            if (uses.containsKey(uuid)) {
                if (uses.get(uuid) < 2) uses.put(uuid, uses.get(uuid) + 1);
                 else if (TimeUnit.MILLISECONDS.toDays(System.currentTimeMillis() - cm.getCooldown(uuid)) < 1) return returnMessage(p, Utils.message(p, "&cPlease wait&e " + Utils.millisToHumanReadable(TimeUnit.DAYS.toMillis(1) - timeLeft) + " &cbefore reusing this command!"));
            } else uses.put(uuid, 1);
        }
        
        Location loc = getLocation(p, name);
        if (loc != null) {
            loc.getChunk();
            p.teleport(loc);
            cm.setCooldown(uuid, System.currentTimeMillis());
            Utils.message(p,"&aTeleported to " + name);
        }
    }

    public boolean returnMessage(Player player, String message){
        player.sendMessage(message);
        return true;
    }
tardy delta
#

wew

#

you're too fast

#

😂

tardy flame
#

🔥

hasty jackal
tardy delta
#

and maybe use a stringbuilder for this?

regal dew
#

Stringbuilder would likely not be any faster

#

you should really only use it when concatenating collections

quaint mantle
#
            if (location.getWorld() != null) {
                RegionManager regionManager = container.get(BukkitAdapter.adapt(location.getWorld()));
                ApplicableRegionSet set = regionManager.getApplicableRegions(BukkitAdapter.asBlockVector(location));
                for (ProtectedRegion r : set) {
                    if (r.getId().equalsIgnoreCase("safezone")) {
                        event.setCancelled(true);
                        attacker.sendMessage(ChatColor.RED + "Can't attack palyers here");
                    } else if (!(r.getId().equalsIgnoreCase("safezone"))) {
                        attacker.sendMessage(ChatColor.RED + "You're now in combat, logging out will cost you!");
                        player.sendMessage(ChatColor.RED + "You're now in combat, logging out will cost you!");
                    }
                }
            }
        }

For some reason the else if gets executed as well, it triggers the "you're now in combat message"

eternal oxide
#

second test for !"safezone" is pointless

quaint mantle
#

I know, i was just testing it. Was hoping it'd work lol

tardy flame
#

Could you give full method?

tardy delta
#

and do a early return is region is null

eternal oxide
#

it just means you have more than one zone and its not called safezone

tardy delta
#

just put an else

tardy flame
#

Else won't fix it

#

Lel

copper vigil
#

Guys how to know server plugins and u are not op there

tardy delta
#

what

quaint mantle
# tardy flame Could you give full method?
@EventHandler
    public void entityDamageEvent(EntityDamageByEntityEvent event) {
        if (event.getEntity() instanceof Player) {
            Player attacker = (Player) event.getDamager();
            Player player = (Player) event.getEntity();
            Location location = player.getLocation();

            WorldGuardPlatform platform = com.sk89q.worldguard.WorldGuard.getInstance().getPlatform();
            RegionContainer container = platform.getRegionContainer();

            if (location.getWorld() != null) {
                RegionManager regionManager = container.get(BukkitAdapter.adapt(location.getWorld()));
                ApplicableRegionSet set = regionManager.getApplicableRegions(BukkitAdapter.asBlockVector(location));
                for (ProtectedRegion r : set) {
                    if (r.getId().equals("safezone")) {
                        event.setCancelled(true);
                        attacker.sendMessage(ChatColor.RED + "Can't attack palyers here");
                    } else {
                        attacker.sendMessage(ChatColor.RED + "You're now in combat, logging out will cost you!");
                        player.sendMessage(ChatColor.RED + "You're now in combat, logging out will cost you!");
                    }
                }
            }
        }```
tardy flame
tardy delta
#

owh

#

lol

copper vigil
#

I can't see can u?

#

Ip:play.thenrk.net

tardy flame
copper vigil
#

Bcz I think they have some mob spawn plugins which they don't tell me

tardy delta
#

:kekw:

#

oh no kekw here

copper vigil
#

And how does the normal spawns are in spigot I think they are different

tardy flame
#

If you are sure that this region is called "something"

#

You could get it by regions.getRegion("something");

#

RegionContainer container = WorldGuard.getInstance().getPlatform().getRegionContainer();
RegionManager regions = container.get(world);

#

which probably

#

could

shadow night
#

How does custom tab works?

#

How to create like texts in tab

ionic hound
#
            Entity herobrine = blockPlaced.getWorld().spawnEntity(blockPlaced.getLocation().clone().subtract(0,3,0),EntityType.ZOMBIE);
            herobrine.setCustomName("Herobrine");
            herobrine.setCustomNameVisible(true);
            herobrine.setHealth(100); /* this is the line

Cannot resolve method 'setHealth' in 'Entity'
i don't understand, what am i doing wrong?

hasty jackal
#

only living entities have health

ionic hound
hasty jackal
#

you need to cast it as a livingentity because right now you're just working with a simple entity

ornate heart
#

Is there a way to apply the crossbow animation while not having a cross bow in your hand? I assume you'd use packets for this?

hasty jackal
#

just create a new class to hold the two values or a record now that they're available

#

they're new in java14 if you want to look into that, otherwise a class is just fine

ancient basin
#

Hello, somone can help me ? I got this error

#

Here is the code corresponding with this error

candid galleon
#

Is that the only code?

ancient basin
#

No but with this error, i think it's become with these few lines of codes

candid galleon
#

Any lines in between?

ancient basin
#

No

candid galleon
#

Weird

#

Try debugging the material of the block

#

and if it’s instsnceof Chest

ancient basin
#

Nope, it doesn't work

worldly ingot
#

I'd argue it's best to call getBlock() once and handle it as a variable

#

Should resolve any issues you're having

quaint mantle
burnt current
#

Hey short question: I would like to create a config with my plugin, and also add and read values in it.
For this I have already written the following in my Main class in the onEnable method.:

FileConfiguration config = getConfig();
    config.addDefault("test", "this is a test");
    saveDefaultConfig();

I also created the config file in my resources folder and deleted my config file in the server folder after the last failed attempt. However, the config is still empty after a reload. Can anyone help me there?

quaint mantle
#

I think something is wrong with my custom item code

hasty jackal
shadow night
#

How to move a entity?

burnt current
hasty jackal
#

oh right I forgot, if you do the defaults that way, you need to do config.options().copyDefaults(true) before calling save

#

alternatively you can use the saveDefaultConfig() by providing a complete config.yml inside your plugin so you don't need to set it manually like this

burnt current
#

yeah now it works, thank you

quaint mantle
#

whut

#
saveDefaultConfig();
#

thats all you need

burnt current
#

i already tried that but then my config was empty

quaint mantle
#

oh

#

¯_(ツ)_/¯

burnt current
#

another question: I would like to read the contents of the config in another class and have already written the following:

public static Main main;
        FileConfiguration config = main.getConfig();
        System.out.println(config.getString("host"));
        System.out.println(config.getInt("port"));
        System.out.println(config.getString("database"));
        System.out.println(config.getString("user"));
        System.out.println(config.getString("password"));

I get an error there. Does anyone know what I could have done wrong here?

eternal night
#

providing the error is pretty useful

#

might just be a null main reference

young knoll
#

Looks null to me

shadow night
#

Is there a way to create a cheat plugin?

echo basalt
#

depends on what you mean by cheat plugin

shadow night
#

Like the forgehax mod

#

It was based on chat commands

#

Now it has "cli"

echo basalt
#

ehh you can emulate the stuff

#

listening to chat events or whatever

shadow night
#

👌

#

But most cheats are client side. Like baritone, x-ray, fullbright (or whatever its called)

chrome beacon
#

Well yeah

#

Never do database queries on the main thread

stone sinew
#

And doesn't query stay opened if it fails?

unreal quartz
#

async™️

#

500ms is very low

#

i think the default is 5000 per connection in hikari

#

or 30000

#

one of those figures is correct

#

that looks like a nightmare

chrome beacon
#

^^

#

Oh no it get's worse

unreal quartz
#

where are you calling bdGet

chrome beacon
#

Check second paste

#

And then first one

#

He's doing like 8 queries per teleport

unreal quartz
#

and, is there any reason you can't do this in one query

chrome beacon
#

So you're teleporting on join?

unreal quartz
#

what does your schema look like

chrome beacon
#

You are. At least in the code

unreal quartz
#

that's

#

interesting

stone sinew
#

Why do you do DOUBLE_NUMBER???

unreal quartz
#

since you're getting all those columns anyway, why can't you select * rather than each individual column

stone sinew
#

Why not just use a json string at that point?

unreal quartz
#

and why is the player username the PK

stone sinew
#

🤦

unreal quartz
#

you need your money back

stone sinew
#

I have never worked with mysql and I know thats all fucked up xD (I know the bare minimum)

unreal quartz
#

a resultset

#

it will have all the columns for each matched row

#

resultSet.getString or getDouble or whatever with the column index

dull sparrow
#

Does somebody know when when using NMS to add a custom entity in 1.17 i'm getting a null error?

#

?paste

undone axleBOT
dull sparrow
#
        WorldServer world = ((CraftWorld) player.getWorld()).getHandle();
        world.addEntity(new CombatLoggedPlayer(player.getLocation()), CreatureSpawnEvent.SpawnReason.CUSTOM);
shadow night
#

What are those things that start with Craft?

unreal quartz
#

yes

unreal quartz
#

insert into ... values (?, ?, ?, ...)

shadow night
unreal quartz
#

bukkit provides a bunch of interfaces (an 'API'), this is what your plugin is programmed against
craftbukkit is the actual implementation of said api to work with the minecraft server and is version specific

#

nothing is stopping you from directly using craftbukkit and nms, except the fact that your plugin will break every version and defeat the point of an API existing in the first place

torn shuttle
#

I'm sort of braindead right now but really want to get this done before bed, how can I set the facing direction from blockdata? can I just cast it if it's an instance of directional?

#

the api docs are looking real blurry to me rn

golden turret
#

of

#

me.johnny.clwocombatlog.nms.v1_17_R1.CombatLoggedPlayer

wary harness
#

I am curious

#

I got my plugin on spigot for few years

#

and my name is unique

#

and now some one makes some project online with that same name

#

of my project

#

do I got any right on it

lean gull
#

i still need help

paper viper
#

holy god

#

there are like at least 20 things i could point out rn that are not good

lean gull
#

please do

#

actually please do if you can tell me how to improve them step by step cause im a dum dum

paper viper
#
private Main pluginInstance = Main.getPlugin(Main.class);
```  why are you doing this? You should be using DI

```java
private static final Set<Integer> allowedSlots = Sets.newHashSet(11, 12, 13, 20, 21, 22, 29, 30, 31, 24);
``` why static?

```java
player.getItemOnCursor().getType().equals(Material.AIR)
``` never ever use .equals on an enum. Use reference equals (`==`)

Store `e2.getSlot()` , `e2.getClickedInventory()`, and each of the items as a variable. The reason why nobody is helping you is because that code is horrendus to read, and hard to help someone with.
#
                // top row
                slots[0] = e2.getClickedInventory().getItem(11);
                slots[1] = e2.getClickedInventory().getItem(12);
                slots[2] = e2.getClickedInventory().getItem(13);
                // middle row
                slots[3] = e2.getClickedInventory().getItem(20);
                slots[4] = e2.getClickedInventory().getItem(21);
                slots[5] = e2.getClickedInventory().getItem(22);
                // bottom row
                slots[6] = e2.getClickedInventory().getItem(29);
                slots[7] = e2.getClickedInventory().getItem(30);
                slots[8] = e2.getClickedInventory().getItem(31);
``` also
#

use a loop here

lean gull
#

really no need to insult y'know

paper viper
#

I'm not insulting, this is constructive feedback

lean gull
#

i do not know what that means in english, english is not my main language

#

lemme google real quick

paper viper
#

I'm also not trying to insult you rn. I am just pointing out the obvious and trying to lead some pointers to help clean up your code. That way, other people are more willing to help you.

lean gull
#

i'm only gonna change this: player.getItemOnCursor().getType().equals(Material.AIR)

paper viper
#

why?

lean gull
#

no offense of course but i do not find the other suggestions reasonable to change

quaint mantle
paper viper
#

But wtf getPlugin(Main.class)

quaint mantle
#

i doubt you're creating multiple of these instances though but, its fine

paper viper
#

on the Main class

quaint mantle
paper viper
#

who the hell

#

like

#

thats def a first

#

lmao

quaint mantle
#

the classic class loader instance grabber

lavish hemlock
#

Java static local variables when

#

#fuckTheStack

paper viper
lavish hemlock
#

You should be using DI
DI is too complex of a concept for a beginner programmer to understand.

lavish hemlock
#

I said "static local variables"

#

as in this cursed goodness:

void fuck() {
    static int i = 0;
}
paper viper
#

Oh no

#

please no

#

do not do that lmao

lavish hemlock
#

:)

paper viper
#

please dont add that xD

#

defining classes inside methods is cursed enough already

lean gull
#

now the 1 item recipe also requires an update by clicking on an allowed slot ):

lavish hemlock
#

bc i would be changed every time the function is called

#

it's a difference between stack memory and static memory

#

meaning
i keeps its value between function calls :)

paper viper
#

tbh i dont see any difference between that and keeping it as a field

#

tho

#

besides visibility ig

#

but if its private

#

who else is gonna access it

lavish hemlock
#

separating the needs of a single function from the needs of the entire class?

#

it's not exactly a useful feature

#

(unless you're working in a non-OOP lang)

paper viper
#

lol

#

in C++ the top of files

#

just all static

#

xD

lavish hemlock
#

god no

#

C++ and Globals is like
a horrible combination

#

in any other language, globals either

  • don't exist
  • are better bc bytecode lang
lean gull
#

so can anybody help?

keen acorn
#

is there a spigot event for players moving items in their inventory
that im just not seeing

paper viper
keen acorn
#

does that work with players using number keys to move items around in the invenotries

eternal oxide
#

and drag event

keen acorn
#

????

#

basically im trying to make a plugin that prevents you from putting things in chests, but you can take things out

keen acorn
#

????????

unreal quartz
#

??????????

keen acorn
#

LMFAO

nova grove
#

How could I get an itemstack with Custom Model Data? In Minecraft then I can do this:
/give @s minecraft:light_gray_stained_glass{CustomModelData:1} and if there is a texture pack then it will texture the item.

hasty prawn
#

ItemMeta#setCustomModelData

gray zodiac
vagrant stratus
gray zodiac
#

o

vagrant stratus
#

Yea,

#

so use the "plugin" param to get the config

#

i.e. plugin.getConfig()

gray zodiac
#
package me.lowjunnhoi.hardcoredeathrespawn;
import org.bukkit.plugin.java.JavaPlugin;
import org.bukkit.Bukkit;
import org.bukkit.GameMode;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerRespawnEvent;
import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.configuration.MemoryConfiguration;
import org.bukkit.configuration.MemoryConfigurationOptions;
import org.bukkit.plugin.Plugin;
import java.io.File;



public class Death extends JavaPlugin implements Listener {
    FileConfiguration config = getConfig();
    private final Main plugin;
    public Death(Main plugin) { this.plugin = plugin;}
    @EventHandler
    public void onRespawn(PlayerRespawnEvent e) {
        Player p = e.getPlayer();
        p.sendMessage(config.getString("changing-gamemode-message"));
        Bukkit.getScheduler().runTaskLater(plugin, () -> p.setGameMode(GameMode.SURVIVAL), 0L);
        p.sendMessage(config.getString("gamemode-changed-message"));

    }

}

error https://paste.md-5.net/wunodujuyi.bash

vagrant stratus
#

public Death(Main plugin) { this.plugin = plugin;} you initialize the config here like so

    public Death(Main plugin) { this.plugin = plugin; config = plugin.getConfig();}

Also "Main" as your main plugin class is bad practice, use your plugin name instead

gray zodiac
#

o

#

like changing the file name and class to HardcoreDeathRespawn?

vagrant stratus
#

Yes, your IDE should allow you to easily rename it within the IDE however

#

unless you're using like...idk... notepad

gray zodiac
#

ok

keen rock
vagrant stratus
gray zodiac
#

Death.java not main

package me.lowjunnhoi.hardcoredeathrespawn;
import org.bukkit.plugin.java.JavaPlugin;
import org.bukkit.Bukkit;
import org.bukkit.GameMode;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerRespawnEvent;
import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.configuration.MemoryConfiguration;
import org.bukkit.configuration.MemoryConfigurationOptions;
import org.bukkit.plugin.Plugin;
import java.io.File;



public class Death extends JavaPlugin implements Listener {
    private final HardcoreDeathRespawn plugin;
    public Death(HardcoreDeathRespawn plugin) { this.plugin = plugin;}
    FileConfiguration config = getConfig();



    @EventHandler
    public void onRespawn(PlayerRespawnEvent e) {
        config.options().copyDefaults(true);
        saveConfig();
        Player p = e.getPlayer();
        p.sendMessage(config.getString("changing-gamemode-message"));
        Bukkit.getScheduler().runTaskLater(plugin, () -> p.setGameMode(GameMode.SURVIVAL), 0L);
        p.sendMessage(config.getString("gamemode-changed-message"));



    }
    public FileConfiguration getConfigFile() {
        return config;
    }
}

still the same error https://paste.md-5.net/kikaxurodi.xml

#

the main file

package me.lowjunnhoi.hardcoredeathrespawn;
import org.bukkit.plugin.java.JavaPlugin;
import org.bukkit.GameMode;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerRespawnEvent;
import org.bukkit.Bukkit;
import org.bukkit.configuration.file.FileConfiguration;



public final class HardcoreDeathRespawn extends JavaPlugin {
    public void onEnable() {
        System.out.println("Plugin enabled!");
        getServer().getPluginManager().registerEvents(new Death(this),this);


    }
    public void onDisable() {
        System.out.println("Plugin disabled!");

    }
}
drowsy helm
#

if its not your main why does it extend JAvaPlugin?

#

only your main should extend JavaPlugin

vague oracle
#

My eyes, why do you use the scheduler to schedule a task 0 ticks later?

#

You can't have your Death class extend JavaPlugin, therefore you can't use getConfig() and should use what optic said

#

Also a useless FileConfig getter

waxen plinth
vague oracle
#

And this isn't one

waxen plinth
#

Seems like something that wouldn't be there for no reason

#

But I could be wrong

vague oracle
#

There is no way he knows any legitimate reason for it if he is extending 2 classes with JavaPlugin

waxen plinth
#

Maybe, but if you told me you can't change someone's gamemode during the respawn event I would believe you

quaint mantle
#

?learnjava

undone axleBOT
quaint mantle
#

That's first

digital plinth
#

anyone have any idea on which plugin here mess with a fireball damage changer plugin?

waxen plinth
#

Lmao

digital plinth
#

whats so funny

waxen plinth
#

That's the most ridiculous thing to ask us

digital plinth
#

i tested some of them out

#

they werent affecting it

quaint mantle
undone pebble
#

ReduceFireballDamage

quaint mantle
#

use getLogger().info(); to send messages into console

digital plinth
#

and fireballkb

waxen plinth
#

Presumably wouldn't be interfering with itself

#

One would hope, at least

digital plinth
digital plinth
quaint mantle
digital plinth
#

it worked fine when i tested it

waxen plinth
#

Regardless it's ridiculous to expect us to just know which of a long list of plugins is messing with your oddly specific plugin

digital plinth
#

oddly speific..

#

its just a event

#

of the highest priority

#

that sets the damage

waxen plinth
#

You haven't told us how it's being interfered with

digital plinth
#

no idea tbh

#

someone told me its not setting the dmg

waxen plinth
#

And even if you did I doubt anyone would be able to just point it out in a list of plugins

#

Well that's not something we can help with

digital plinth
#

well someone might have knowldge on how those plugins work

waxen plinth
#

We're not wizards

digital plinth
#

eg i dont use essentials

nova grove
#

If I wanted to override a vanilla command like /give or /list then do I need to do anything special or can I just make the command?

waxen plinth
#

No clairvoyance

digital plinth
#

does essentials mess with damages

waxen plinth
nova grove
#

Thanks.

waxen plinth
#

And of course

#

You can always just try it

digital plinth
#

indeed indeed

tepid cargo
#

how can i initialize an empty set of

Collection<ProxiedPlayer>

?

young knoll
#

Use anything that implements collection

#

Like an array list

burnt current
# eternal night providing the error is pretty useful

sure

Exception in thread "main" java.lang.NoClassDefFoundError: org.bukkit.plugin.java.JavaPlugin
    at java.base/java.lang.ClassLoader.defineClassInternal(ClassLoader.java:491)
    at java.base/java.lang.ClassLoader.defineClass(ClassLoader.java:452)
    at java.base/java.security.SecureClassLoader.defineClass(SecureClassLoader.java:151)
    at java.base/jdk.internal.loader.BuiltinClassLoader.defineClass(BuiltinClassLoader.java:1137)
    at java.base/jdk.internal.loader.BuiltinClassLoader.findClassOnClassPathOrNull(BuiltinClassLoader.java:924)
    at java.base/jdk.internal.loader.BuiltinClassLoader.loadClassOrNull(BuiltinClassLoader.java:832)
    at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:790)
    at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:168)
    at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:1108)
    at de.straussfalke.plugin.test.main(test.java:14)
Caused by: java.lang.ClassNotFoundException: org.bukkit.plugin.java.JavaPlugin
    at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:792)
    at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:168)
    at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:1108)
    at java.base/java.lang.ClassLoader.defineClassImpl(Native Method)
    ... 10 more
waxen plinth
tepid cargo
#

thank you 🙂

nova grove
#

How could I change the color of a players name in the tab list?

maiden briar
#

Set a prefix for a team and add the player

#

You do this with the scoreboard

#

Bukkit.getScoreboardManager().registerNewBoard()
#registerTeam
#Team.addEntry(player.getName())
#Player.setScoreboarf

vernal pier
#

you can append a color in front of the player list name

gray zodiac
#

My plugin isn't working 🤔

package me.lowjunnhoi.hardcoredeathrespawn;
import org.bukkit.plugin.java.JavaPlugin;
import org.bukkit.GameMode;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerRespawnEvent;
import org.bukkit.Bukkit;
import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.plugin.Plugin;



public final class HardcoreDeathRespawn extends JavaPlugin implements Listener {

    FileConfiguration config = getConfig();

    public void onEnable() {
        System.out.println("Plugin enabled!");
        config.options().copyDefaults(true);
        saveConfig();



    }
    public void onDisable() {
        System.out.println("Plugin disabled!");

    }
    @EventHandler
    public void onRespawn(PlayerRespawnEvent e) {
        Player p = e.getPlayer();
        p.sendMessage(config.getString("changing-gamemode-message"));
        Bukkit.getScheduler().runTaskLater((Plugin) this, () -> p.setGameMode(GameMode.SURVIVAL), 0L);
        p.sendMessage(config.getString("gamemode-changed-message"));



    }
    public FileConfiguration getConfigFile() {
        return config;
    }
}
chrome beacon
#

You forgot to register the listener

opal juniper
#

also - don’t sysout, use your plugins logger.

tardy delta
#

coding in the morning 🤔

#

my brain hurts

quaint mantle
#

anyway to get potioneffecttype from a string ?

#

oh getByName method

tardy delta
#

uh will one of this methods save the object to the file?

hasty jackal
#

well not directly, but they'll be used when the configuration they're contained in should get saved. so partially yes.

ivory sleet
#

They just do the serialization work for you

tardy delta
#

so i should never call those methods?

ivory sleet
#

Wat

hasty jackal
#

correct, they'll be called for you

tardy delta
#

ok

ivory sleet
#

Well yeah in Bukkit context probably not

#

@tardy delta have you registered the ConfigurationSerializable?

#

Else it won’t use those methods

tardy delta
#

wdym by registered?

#

prob not then

ivory sleet
#

ConfigurationSerialization::register

#

Or smtng

#

Send it in paste

tardy delta
#

?paste

undone axleBOT
tardy delta
gray zodiac
ivory sleet
#

FourteenBrush in onEnable add smtng like
ConfigurationSerialization.registerClass(Home.class);

tardy delta
#

ok

hasty jackal
#

@gray zodiac this inside the listener is referencing Death which is not your plugin, and thus the cast fails. you need to prefix it with your plugin type aka HardcoreDeathRespawn.this to get this to point to the right thing in that instance

gray zodiac
#

how 🤔

hasty jackal
#

aka HardcoreDeathRespawn.this

tardy delta
#

Main.getInstance() uwu

gray zodiac
#

like this?

getServer().getPluginManager().registerEvents(new Death(), HardcoreDeathRespawn.this);
hasty jackal
#

no, when you do the cast, where the error happens, L36

#

you're doing (Plugin)this, but this is pointing to the instance of Death which is not a plugin

tardy delta
#

do you have a static method inside your main class which returns the class instance?

gray zodiac
#

what's that, I'm new to java

tardy delta
#

make a private static field called instance or something inside your main class

ivory sleet
#

FourteenBrush don’t teach him a static singleton

tardy delta
#

and in onEnable do instance = this;

#

nawh

ivory sleet
#

It’s a pattern that shouldn’t be used just like that

tardy delta
#

i use it 😖

hasty jackal
#

literally just need to change the one word and it'll work :(

ivory sleet
#

Yes because you don’t know why it’s bad presumably

tardy delta
#

that

ivory sleet
#

First of all spigot provides a singleton already that does not break the pattern, JavaPlugin::getPlugin

tardy delta
#

with Main.class as argument?

ivory sleet
#

Yes

tardy delta
#

hmm if thats better

ivory sleet
#

It guarantees the right plugin instance will be returned, aka the one instantiated and loaded from plugin startup.

#

That is not a guarantee by using these custom singletons

tardy delta
#

so like this

 public static Main getInstanceTwo() {
        return JavaPlugin.getPlugin(Main.class);
    }
ivory sleet
#

No why

#

That’s useless

tardy delta
#

ah i understand

ivory sleet
#

Anyways I was really nitpicky now but yeah

tardy delta
#

so if i need to instance i make a field and assign it to JavaPlugin::getPlugin(Main.class)?

ivory sleet
#

Yeah

#

Or course it might arguably be better to just pass the plugin instance through the constructor

#

But that’s one of the proper ways

tardy delta
#

oki thanks

quaint mantle
#

is there a way to prevent anvils from being damaged?

wary harness
#

@ivory sleet I got qustion on right about plugin name

#

my plugin has specific name

#

unique

#

I use it for like 5 years

#

and now I found out some one is using and branding it for last 3 weeks

#

for it self

#

can I act

#

against it ?

ebon zodiac
#

hello i needed help on the plugin Crates Plus-i wanted to ask that how can i give in-game currency in a crate

#

can anyone help me?

echo basalt
#

if it can run commands just run the eco give

ebon zodiac
#

how idk how can it

#

hello?

#

anyone?

candid galleon
#

DDX just pause

#

Please don’t ping people because you’re impatient, it’s rude

#

it’s the age of the internet, we have automated systems of finding resources, have you tried googling the most basic question?

wary harness
#

am I rude 🙂

#

😂

#

could not resist

ebon zodiac
quaint mantle
#

hello i have a problem with shadowJar in gradle
the relocate apears gray
and doesnt work

candid galleon
#

Try hovering over it Pmz?

candid galleon
quaint mantle
#

i know this

candid galleon
#

“It’s not working” is literally the shittiest description

#

Try removing the () in front of shadowJar?

quaint mantle
#

but this was told in a wiki

#

oh wait let me remove it

candid galleon
#

👏 at least you tried 🙂

shadow night
#

How do i give a item with nbt data to a player ?

candid galleon
#

Why do you want to?

ivory sleet
quaint mantle
wary harness
#

not spigot

#

but it is big

#

and I think I do have right to it

ivory sleet
#

Well I’m not really the guy when it comes to licenses and copyrighting sorry

wary harness
#

I was curious

candid galleon
ivory sleet
quaint mantle
ivory sleet
#

Well that’s not much to go on

quaint mantle
#

and the file size doesnt change at all

#

and when i use it, classnotfound error

ivory sleet
#

Send your build.gradle

#

Also how do u build?

quaint mantle
#

with this build thing

ivory sleet
#

Makes sense why it doesn’t work

#

You should use the task shadowJar

quaint mantle
#

ok let me test

hasty jackal
#

if something in the gradle shows up weird in the IDE, it doesn't have to be an error, groovy is just notoriously hard to get right

quaint mantle
#

thanks. worked

ivory sleet
#

Yeah kotlin dsl much better

quaint mantle
#

and how to change the output file name ?

ivory sleet
#

shadowJar.baseName probably

#

The same as jar

#

Just do it on shadowJar instead

quaint mantle
#

just want to remove this all

ivory sleet
#

shadowJar.classifier ''

quaint mantle
#

bruh thanks

ivory sleet
#

No worries

ebon zodiac
#

.00000322

#

32000003

#

0.23

#

32

ivory sleet
#

?

ebon zodiac
eternal oxide
#

You are in the wrong channel for plugin support

quaint mantle
#

how to give a player head item stack a texture value

ivory sleet
#

If you use spigot you’ll have to use reflection

#

Like if you want to set a specific head texture

onyx shale
#

yes..good ol reflection

quaint mantle
#

or skullmeta

ivory sleet
#

No

#

It only takes an OfflinePlayer

quaint mantle
#

ok

#

so how to do that

ivory sleet
#

Hmm pretty sure google can help you here

onyx shale
#
private void buildMedPack(){
        ItemStack head = new ItemStack(Material.PLAYER_HEAD, 1);
        GameProfile skin1803103601 = new GameProfile(UUID.fromString("f017c5f5-e70e-4b16-9cb7-a82fcb1af9c3"), "skin1803103601");
        skin1803103601.getProperties().put("textures", new Property("textures", "ewogICJ0aW1lc3RhbXAiIDogMTU4OTcyOTE0Nzk5MiwKICAicHJvZmlsZUlkIiA6ICJhNmE3MzI2NjZhZTI0YjIwYWQyNmIzYWZkZWZjNmM1MCIsCiAgInByb2ZpbGVOYW1lIiA6ICJNeXN0aWNHYW1lck1hbiIsCiAgInNpZ25hdHVyZVJlcXVpcmVkIiA6IHRydWUsCiAgInRleHR1cmVzIiA6IHsKICAgICJTS0lOIiA6IHsKICAgICAgInVybCIgOiAiaHR0cDovL3RleHR1cmVzLm1pbmVjcmFmdC5uZXQvdGV4dHVyZS9lNTgwYzBlYWYzZTFkMGFlNWE0MmQ5NjY0MWJlZGMyNTFhZGQ2ZjA5NzI1NDI3OWJhYTJmNjI5OWNjZTYzMjcwIgogICAgfQogIH0KfQ==", "rXy8bq+RjMJiawajWDm2+N7jV+kCGwqYSmOLth5A7is0uyR8Aqe9DDcxUdAAdHJd+JOx5/KY9EmO8ExobQ0kt2sarJLlnkVQa3o+gEeadFj9DA6VwsWWki2qqAvgZQsQOe3w41UF9M3C96Z/EIBR8hZp8kG73WKwA3xQ9b6juk5PxDSGEuJbnpYZW5fxraOSmElMFqWJelU22z15I1nqk6aWzwa9WHh/ywX0Hy4BvqWvwqNhBoxHREwQ8TOLyairKxlo9YX/Q+0OaRHa120vynLKH2jtBH3qD2XUugnopyN4eoCos2uOkFE2T4zeBKkUSE10xNuMpowKXZlmXEi4qGh+KGcY1b284vvXX4Muztx8kxp+xSe5vAxVGSVqkRR7gt0yK1DCxlkgBCWERoNoBR81oNqON6Ild/rdhQBEZsTW/SuCsPTQa+GR6uOeNadyXSM6tSG8CAxaon0urrbNoy9rud3dQCrcwbkpzhdsQwaROWGhsdUaHfrSZ6z7wxHQTiAC8QLiy4NukyHfp5w3vMbUbs+6LCT774MdSo4hioCKalwHXfaDXHrXxPKjsfYCmDTRehBBioQpBakIv4vb3upWdo7WFgjzau83PljVP4lYfqaO3bktZtcLWT0VtYAbsbXH6JROrhNH1LIeGomUcP5ZjJeTYCc9IqbbvEV1oyQ="));
        SkullMeta headMeta = (SkullMeta) head.getItemMeta();
        try {
            Field profileField = headMeta.getClass().getDeclaredField("profile");
            profileField.setAccessible(true);
            profileField.set(headMeta, skin1803103601);

        } catch (IllegalArgumentException | NoSuchFieldException | SecurityException | IllegalAccessException error) {
            error.printStackTrace();
        }
        headMeta.setDisplayName(ChatColor.GREEN+"MedPack");
        head.setItemMeta(headMeta);
        medpack=head;
    }
#

ignore the bigass texture property

ivory sleet
onyx shale
#

well this might have some problems in 1.17 idk if they changed internals

quaint mantle
onyx shale
#

i mean... yeah

#

only texture one tho

#

if you have a specific skin in mind use mineskin to get texture

quaint mantle
#
   private ItemStack skull(String value, SkullMeta headMeta){
        ItemStack head = new ItemStack(Material.PLAYER_HEAD, 1);
        GameProfile skin1803103601 = new GameProfile(UUID.fromString("f017c5f5-e70e-4b16-9cb7-a82fcb1af9c3"), "skin1803103601");
        skin1803103601.getProperties().put("textures", new Property("textures", value));
        try {
            Field profileField = headMeta.getClass().getDeclaredField("profile");
            profileField.setAccessible(true);
            profileField.set(headMeta, skin1803103601);

        } catch (IllegalArgumentException | NoSuchFieldException | SecurityException | IllegalAccessException error) {
            error.printStackTrace();
        }
        return head;
    }

is it ok ?

#

nope i dont think the skullmeta thing is ok

#

thanks anyway

onyx shale
#

you never created a meta in the first place..

quaint mantle
#

@ivory sleet how does one make a List containing days of the week?

copper dove
#

Hello all!
Was curious if there was a more efficient way to get a 10x10 radius in front of an entity and 'mine' it.
My current code (working but inefficient):

Location loc = new Location(world, mule.getLocation().getX(), mule.getLocation().getY(), (mule.getLocation().getZ()-1));
                    for (int ii = 0; ii < 5; ii++) {
                        for (int i = 0; i < 10; i++) {
                            // Destroys column in front of location
                            loc.getBlock().setType(Material.AIR);
                            loc.add(0,1,0);
                        }
                        loc.add(1, -10, 0);
                    }
                    loc.add(-5, 0, 0);
                    for (int ii = 0; ii < 5; ii++) {
                        for (int i = 0; i < 10; i++) {
                            // Destroys column in front of location
                            loc.getBlock().setType(Material.AIR);
                            loc.add(0,1,0);
                        }
                        loc.add(-1, -10, 0);
                    }

It's meant to function as a drill.

Currently does: https://gyazo.com/0fc79ba0524c724054aeff912a8ab334

Thank you!

#

(also only works in the North direction)

quaint mantle
hasty jackal
onyx shale
# copper dove Hello all! Was curious if there was a more efficient way to get a 10x10 radius i...
Directional directional = (Directional) dispenser.getBlockData();
                BlockFace face = directional.getFacing();
                Vector vector = face.getDirection();
                Location location = dispenser.getBlock().getRelative(face).getLocation();
                BlockIterator blockIterator = new BlockIterator(dispenser.getWorld(), location.toVector(), vector, 0, 10);
                while (blockIterator.hasNext()) {
                    Block b = blockIterator.next();
                    if(b.getType()!=Material.AIR){
                        break;
                    }
                    for(Entity entity : dispenser.getWorld().getNearbyEntities(b.getLocation(),1,1,1)){
                        if(entity.getType()!= EntityType.PLAYER) {
                            entity.setVelocity(vector.clone());
                        }
                    }
                }
            }
``` all you need is to get the facing direction
#

also ignore the entity loop

quaint mantle
#

Server with protocollib is crashin on 1.17

#

What can I do?
I use the latest version of it

#

Please help me 😦

onyx shale
#

ask in the right section,also dont just 'its crashing' paste actual error logs

halcyon mica
#

Why do people hardcode texture properties

#

Just have the texture in a resource file, and load/cache it when necessary

halcyon mica
#

Easier to update, maintain and modify

quaint mantle
#

Where can I paste the log?

onyx shale
#

not much of a diffrence if its hardcoded its gonna stay the same forever

quaint mantle
#

It's longer than 2000 letters 😦

halcyon mica
#

Not if you need to change something

#

Or update it

halcyon mica
#

Plus, hardcoded textures make dynamicially generated ones impossible

onyx shale
#

its for a medkit skin

#

i doubt i ever will need another skin than the one

cold field
#

Guys does it exists a method to know which dimension the world is?

eternal oxide
#

dimension? So not spigot?

quaint mantle
#

What's the best way to check if the player value in an hashmap has died? I'm puzzeling around, but can't get it right

cold field
quaint mantle
#

I'm trying to send a message to the key (Player) of the hashmap once the target player (hashmap value) has died,

cold field
#

Thank you. I was searching on the doc words like dimension, nether, end. I even though of cheking the biomes.

#

Didn't think of Environments

hasty jackal
quaint mantle
#

That's a good idea tbf

shadow night
#

how do i make so that users dont see a message from someone?

#

im creating a plugin, where the user needs to send his nick when he joins first time

#

thats the reason

copper dove
#

Any idea what's wrong?

#

Trying to get my entity to go from point a to b

hasty jackal
shadow night
hasty jackal
#

well ... you get the recipients and clear the set getRecipients().clear()

quaint mantle
#

how do i check for placing a sign with protocollib

cold field
#

When does entities despawn?

copper dove
#

If anyone can show me how to get an entity to walk to a location on 1.17 using NMS (or otherwise) I'll PP you $5

dim bluff
cold field
#

Ok ty. Another question. Does the server load back entities if the server restarts?

dim bluff
#

not sure... I can test it if u want

cold field
#

I can also test. Ty anyway

stone sinew
cold field
#

Ohh, ty

quaint mantle
sweet sun
#

anyone that have a good punish manger with web interface?

grand coral
#

How can I send a Player to another Server with Spigot plugin command

dry pike
#

So I’m trying to figure out a way to pathfind off the main thread possibly on a completely different server. Weather I create a application that takes a world or a list of chunks and then calculates, returning a path. Or even just run another Spigot server on another machine and send data between the servers basically using one server just for performance heavy calculations(not sure if bungeecord is capable of this I’ve never used it as I have always just used spigot). Has anyone ever attempted this, does it sound possible, and are there any issues to using a method like this that come to mind? I’m no expert and any ideas to help me get started would be appreciated.

quaint mantle
#
for (Player key : this.main.bounties.keySet()) {
                   for (Player p : Bukkit.getOnlinePlayers() ) {
                       if (this.main.bounties.containsValue(player)) {
                           this.main.bounties.remove(p);

                           this.main.bountyDeathCheck.get(player).sendMessage(ChatColor.RED + "Your bounty " + ChatColor.GOLD + player.getDisplayName() + ChatColor.RED + " has died, bounty has been nullified");
                           this.main.bountyDeathCheck.remove(player);
                       }
                   }
               }

What would i run a nullcheck against? it returns null when there's multiple this.main.bounties.keySet
When doing a nullcheck on this.main.bounties.keySet it'll say it's always null.

eternal oxide
#

First you can;t remove from a set you actively looping without using an iterator. Secondly, if it says its always null, you didn;t initialize the set

quaint mantle
#

Removing seems to work just fine?

eternal oxide
#

you said it was null, so theres nothing to remove

quaint mantle
#

when there's MULTIPLE instances it seems to return null

eternal oxide
#

also, why are you looping all online players for every entry in yoru keyset?

#

then you ignore the actual keyset and never use it

near crypt
#

Is there a way of getting the landing spot of a dragonegg?

quasi flint
#

iterate over the chunk until u find the egg

#

dont know if it will work

#

can tp 7 blocks in xz

#

max

#

dont knoe if theres an method for it somewhere

hasty prawn
near crypt
#

and can you get the position before you click on it?

#

or is it even set then?

hasty prawn
#

That fires before it teleports.

#

You can cancel it

#

But it's not predetermined afaik

near crypt
#

so it is possible to get the location before it is clicked?

hasty prawn
#

Well not before it's clicked, before it teleports.

near crypt
#

okay

quaint mantle
#

Changed the code a bit

 if (this.main.bountyDeathCheck.containsKey(player)) {
    for (Map.Entry<Player, Player> entry : this.main.bounties.entrySet()) {
        if (entry.getValue().equals(player)) {
        this.main.bounties.remove(entry.getKey());
      }
    }
  }
}
java.util.ConcurrentModificationException: null
        at java.util.HashMap$HashIterator.nextNode(HashMap.java:1584) ~[?:?]
        at java.util.HashMap$EntryIterator.next(HashMap.java:1617) ~[?:?]
        at java.util.HashMap$EntryIterator.next(HashMap.java:1615) ~[?:?]
        at com.odyssey.events.OnDeath.onDeath(OnDeath.java:42) ~[Main-1.0-SNAPSHOT.jar:?]
        at com.destroystokyo.paper.event.executor.asm.generated.GeneratedEventExecutor4186.execute(Unknown Source) ~[?:?]
        at org.bukkit.plugin.EventExecutor.lambda$create$1(EventExecutor.java:69) ~[patched_1.17.1.jar:git-Paper-259]
        at co.aikar.timings.TimedEventExecutor.execute(TimedEventExecutor.java:80) ~[patched_1.17.1.jar:git-Paper-259]
        at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:70) ~[patched_1.17.1.jar:git-Paper-259]
        at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:624) ~[patched_1.17.1.jar:git-Paper-2```
hasty prawn
#

You can't call remove inside the loop when you're iterating over the Set.

eternal oxide
#

As I said earlier, you can;t remove from a collection you are looping ConcurrentModificationException

hasty prawn
#

Gotta use the good ol Iterator bounce

eternal oxide
#

Use an iterator or note what needs to be removed and remove it when finished

quasi flint
#

ConcurrentModException

#

good ol

quaint mantle
#

Hmm

quasi flint
#

remove in loop bad

#

when looping over smth

hasty prawn
#

Can't removeIf work here too? Might be a better option.

quasi flint
#

prob

quaint mantle
#

I'll take a look

quasi flint
#

🍞

#

bread

quaint mantle
#

Agreed

quaint mantle
#

using ConcurrentHashMap fixed the problem

ivory sleet
#

Breh

#

You should really be using a normal HM unless you’re using it concurrently across threads and need the thread safety

round finch
#

How do i make Hex Color in chat?

ivory sleet
#

There is a few ways

#

But ChatColor::of is usually the way to go

round finch
#

ChatComponent ?

ivory sleet
#

You’d pass the ChatColor instance to the ChatComponent then

round finch
#

i have no idear how this works

ivory sleet
#

What are you doing more specifically?

round finch
#

Making some sort of chat format plugin

ivory sleet
#

Oh

#

First decide a hex chat format you want to use

round finch
#

i want to replace hashtag+1559fbb with color

hasty prawn
#

You can use RegEx

ivory sleet
#

Like
#1559fb

#

?

round finch
#

yes

ivory sleet
#

Yeah use regex like dessie said

round finch
#

wut regex?

ivory sleet
#

Regular expressions

shadow night
#

How do i add something to config when a player joins
For example, i want to add a field to the config, thats is called Players.playername

ivory sleet
#

Get the config, set the value for the given path, save the config

shadow night
#

Ok

ivory sleet
#

Tho you should really isolate the config from the player data

round finch
#

what spigot and etc do i need to code?

#

to make hex color text

opal juniper
#

ChatColor.of iirc

#

make sure it’s the bungee one tho

quaint mantle
#

or use Adventure/Bungee Components

shadow night
round finch
#

just want to use spigot and not bungee components thank you

ivory sleet
#

Listen to AsyncPlayerChatEvent, get the message, use regex to find the hex colors or iterate through the string as a char array, parse, rebuild the message, set it back

hasty prawn
#

The ChatColor bungee component is built into Spigot

ivory sleet
hasty prawn
#

Not Conclure using C++ syntax NOOO

ivory sleet
#

Method reference > javedoc grammar

round finch
#

So everything i need is in chatcolor?

ivory sleet
#

Ye

round finch
#

and no fancy compont stuff and .build stuff?

ivory sleet
#

Nope

hasty prawn
#

Nope, literally ChatColor.of("#ffffff") would give you white iirc.

ivory sleet
#

Tho if it’s like to parse the chat, you still need to find where the colors are

hasty prawn
#

You just need to find all the HEX colors in the String

#

Yeah ^

#

That's where RegEx comes in

shadow night
dim bluff
#

anyone know why I cant see the npc's after I die or go through portal and come back

hasty prawn
#

Because your client unloads them and the server doesn't know they exist, so it's not resent

dim bluff
#

I've tried re injecting the packets

#

doesnt work

#

oh actually its just that somehow when I inject in the respawn event it doesnt work

shadow night
#

I made a Player Join event, where I tried to create a field in config called Players.playername.registered that is false by default and then save it, but when I put if(!this.plugin.config.getBoolean("Players." + event.getPlayer().getName() + ".registered")) { event.getPlayer().sendMessage("hello"); } into the code to check if it runs, when the player joined nothing happened.

hasty prawn
#

Print what the boolean is

shadow night
#

Okay

dim bluff
#

wise words from 7smile7

shadow night
dim bluff
#

like making a list with everything from your config

#

tbh in general it makes it easier... idk how and why it helps the server

shadow night
#

¯\_(ツ)_/¯

stone sinew
dim bluff
stone sinew
#

np

dim bluff
stone sinew
#

np

toxic mesa
#

Guys i'm stupid, haven't used maven for a long time.
Pom: https://pastebin.com/PjcWM9J2
Error when using anything: https://pastebin.com/xAzFgWxn
My editor sees it and stuff so it's probs compiling or whatever but im stupid XD
please help

eternal night
#

you need to actually define the maven-shade-plugin for it to shade your dependencies

toxic mesa
#

ty

#

im stupid

#

sorry

quaint mantle
#

does an nms has ai by default or we have to set pathfinder goal ?

#

if want it to have its default ai if it doesnt have by default

hasty prawn
#

Entities have default AI yeah

quaint mantle
#

anyway to modify the speed of it ?

#

should we set the pathfinder ?

hasty prawn
#

If the speed modifier is public you can get the goal instance and set it, or remove that goal and re-add it with your modified speed.

west linden
#

How would i use a getConfig() in a method . When i try i getjava: non-static method getConfig() cannot be referenced from a static context

quaint mantle
hasty prawn
quaint mantle
#
package e.e;

import net.minecraft.world.entity.EntityCreature;
import net.minecraft.world.entity.EntityTypes;
import org.bukkit.Location;
import org.bukkit.craftbukkit.v1_17_R1.CraftWorld;

public class CustomEntity extends EntityCreature {
    public CustomEntity (EntityTypes<? extends EntityCreature> type, Location loc) {
        super(type, ((CraftWorld) loc.getWorld()).getHandle());
        this.setPosition(loc.getX(), loc.getY(), loc.getZ());

    }


}

this is my current class

hasty prawn
#

Idk what the obfuscated name for the goalSelector is, but basically you need to find that and then you can add/remove Goal instances.

quaint mantle
#

if i use the a method
will it remove the current ai of the goal and not other ai ?

hasty prawn
#

Well look what a() does.

quaint mantle
#

what goal shod i set

hasty prawn
#

What are you trying to do

quaint mantle
#

simply change its speed

hasty prawn
#

Like, it's walking speed?

quaint mantle
#

yes

hasty prawn
#

Oh. You can just use Attribute Modifiers for that.

quaint mantle
#

and how to do that ?

hasty prawn
#

LivingEntity#getAttribute()

quaint mantle
#

its nms entity

hasty prawn
#

Are you only setting it's speed?

quaint mantle
#

yes

hasty prawn
#

Then you don't need an NMS entity

#

Just spawn it normally

quaint mantle
#

no its not only speed

#

like

#

armors

#

health

#

custom name

#

and stuff

hasty prawn
#

Yeah you can do all that with Spigot

quaint mantle
#

is it possible with a normal entity

#

?

#

like customizable

#

getting the type from config

#

like tht

#

is it possible with spigot ?

hasty prawn
#

Armor, Health and Speed are all Attributes.

#

Yes.

quaint mantle
#

the entity type

#

is it editable ?

hasty prawn
#

Like getting an entity type from a config and spawning it?

quaint mantle
#

yes

hasty prawn
#

I think you can do that Thonk

quaint mantle
#

ok but how

hasty prawn
#

World#spawnEntity(). You just parse the EntityType from whatever value is in the config.

quaint mantle
#

and edit is attributes ?

hasty prawn
#

Yes

quaint mantle
#

how to

#

:l

hasty prawn
#

I told you, getAttribute()

quaint mantle
#

should i cast the entity i spawned to livingentity?

#

and how to edit the armor

#

like i have this

tardy delta
#

if i actually want to use one of f.e. vault's features, should i check if the plugin itself != null or if the plugin is enabled?

hasty jackal
#

don't you just use the service manager?

#

which would only exist if the plugin exists and is enabled

quaint mantle
tardy delta
#

would this check if the plugin is enabled?
getServer().getPluginManager().getPlugin("Vault") != null

tardy delta
#

uh yeah i did

tacit drift
#

not just "e"

quaint mantle
tardy delta
quaint mantle
tardy delta
#

hmm

opal juniper
#

im not familiar with shaped recipes - what would this look like?

#

i thought like this but it doesnt work

hasty jackal
#

should be second + third row, you made the first row empty

opal juniper
#

yep - it works now

#

thanks

#

u have never used them lol

#

but that makes sense

quaint mantle
#

i dont know if it helps

burnt current
#

Hey Quick question: How can you call the Config.yml of the plugin if you are not in the main class? In the main class you can do this with this.getConfig Does anyone know how I can use this in another class?

crimson terrace
#

youre gonna have to set a variable as "instance" with the main class

#

and make a getter to retrieve it

#

this works well

rocky glacier
#

so i tried to import the same map twice (called island1, island2) but as soon as i try to /mvimport island2 normal it fails

tardy delta
#

uh i'm back, which event priority is executed after the others and decides whether the event should be cancelled or not?

#

did you put the jar under your dependencies?

grand coral
#

How to get a Material from config (name/id)

burnt current
# crimson terrace <Main class>.getInstance().getConfig() i think

ok so

        System.out.println(Main.instance.getConfig().getString("host"));
        System.out.println(Main.instance.getConfig().getInt("port"));
        System.out.println(Main.instance.getConfig().getString("database"));
        System.out.println(Main.instance.getConfig().getString("user"));
        System.out.println(Main.instance.getConfig().getString("password"));

should be right?

tardy delta
burnt current
# burnt current ok so ```java System.out.println(Main.instance.getConfig().getString("h...

because when i run this i get the following error:

Exception in thread "main" java.lang.NoClassDefFoundError: org.bukkit.plugin.java.JavaPlugin
    at java.base/java.lang.ClassLoader.defineClassInternal(ClassLoader.java:491)
    at java.base/java.lang.ClassLoader.defineClass(ClassLoader.java:452)
    at java.base/java.security.SecureClassLoader.defineClass(SecureClassLoader.java:151)
    at java.base/jdk.internal.loader.BuiltinClassLoader.defineClass(BuiltinClassLoader.java:1137)
    at java.base/jdk.internal.loader.BuiltinClassLoader.findClassOnClassPathOrNull(BuiltinClassLoader.java:924)
    at java.base/jdk.internal.loader.BuiltinClassLoader.loadClassOrNull(BuiltinClassLoader.java:832)
    at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:790)
    at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:168)
    at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:1108)
    at de.straussfalke.straussfalkeserverplugin.test.main(test.java:13)
Caused by: java.lang.ClassNotFoundException: org.bukkit.plugin.java.JavaPlugin
    at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:792)
    at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:168)
    at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:1108)
    at java.base/java.lang.ClassLoader.defineClassImpl(Native Method)
    ... 10 more
grand coral
tardy delta
#

you have to put it in highercase i think

#

uppercase*

crimson terrace
grand coral
quaint mantle
burnt current
quaint mantle
#

@burnt current I’d recommend using Dependancy injection to get an instance of your main class

#

Instead of using a static singleton

#

Makes it much cleaner when you’re adding to the constructor

burnt current
#

ok i will have a look at this thank you for the tip

quaint mantle
#

No worries, if you’d like I can teach you this quickly?

#

Won’t take long 🙈

burnt current
#

okay just try

quaint mantle
#

Pardon?

shadow night
#

How do i create a plugin that support mutiple versions?

paper viper
#

if you use NMS, you must provide an implementation each time the server revision changes

burnt current
quaint mantle
burnt current
#

so it wasnt

#

Then I'm sorry 😅

quaint mantle
#

it was for you... lmfao

burnt current
#

Oh, ok. Then why do you write Pardon?

tardy flame
#

Bruuh

crimson terrace
#

well it does nothing else

#

also its better for readability imo

burnt current
tardy flame
crimson terrace
#

yeah I do not care 🙂

tardy flame
#

Die

tardy flame
crimson terrace
tardy flame
#

:c

toxic mesa
#

Can someone spoonfeed me what im doing wrong?
https://pastebin.com/Wq0QjfJe <- pom
java.lang.NoClassDefFoundError: club/minnced/discord/webhook/WebhookClientBuilder <- error
Just need an example

ivory sleet
#

Idk about spoon feed

hasty prawn
#

What's the best way to detect a block within a specific area/BoundingBox?

My exact use case is I need to check if there's a protected block (using BlockLocker) within the bounds. Would I need to iterate through every single block and check if it's protected?

toxic mesa
tacit drift
#

google

toxic mesa
ivory sleet
#

Gradle (:

tacit drift
#

change mainClass

tacit drift
toxic mesa
quaint mantle
eternal night
#

you google

quaint mantle
#

No I ask here in the Java development help chat

#

Ty

eternal night
#

being able to gather information/skills as easy as that through various search engines is a pretty important part of being a developer

ivory sleet
#

Arrays.<String>asList(string,string2);

grand coral
#

how can I send a player to another server by clicking on an item

lost matrix
lost matrix
grand coral
#

Thx

shy wedge
#

Hey, I want to get player's location to check if he enters/leaves an specified area. Is it more efficient to get the everyone's location like each 1 second, or to check it separately for every player on PlayerMoveEvent, Join Event, etc. ?

ivory sleet
#

how precise does it have to be?

shy wedge
#

No need really, I want it to display bossbar in the area

lost matrix
lost matrix
shy wedge
#

Thanks for help/opinion!

burnt current
#

Quick question: I have created a config.yml which looks like this:

MySQL:
  host: localhost
  port: 3306
  database: database
  user: user
  password: password

then I added the following line to my onEnable method:
this.saveDefaultConfig();
i also created the following variable:

public static Main instance;

instance = this;

a getter also exists:

public DataSource getDataSource() {
        return dataSource;
    }```
and then tried to read out the data from the Config with the following method:
```java
public static void main(String [] args) {

        System.out.println(Main.getPlugin().getConfig().getString("MySQL.host"));
        System.out.println(Main.getPlugin().getConfig().getInt("MySQL.port"));
        System.out.println(Main.getPlugin().getConfig().getString("MySQL.database"));
        System.out.println(Main.getPlugin().getConfig().getString("MySQL.user"));
        System.out.println(Main.getPlugin().getConfig().getString("MySQL.password"));

    }```
but  if i run the method i get the following error:
https://hastebin.com/cefurucobe.csharp

does anyone happen to know what I did wrong?

(Sorry if it got a little texty but, as it's a few minor code snippets I thought it was the best way to do it.)
brittle loom
#

Hello, I'm trying to find a way to prevent players from leaving a region. Here's what I've done so far:``` @EventHandler
public void onPlayerMoveEvent(final PlayerMoveEvent event) {
final Player player = event.getPlayer();
final ElementalSettings settings = ElementalSettings.getInstance();

    if (settings.getLobbyRegion() != null) {
        if (!settings.getLobbyRegion().isWithin(player.getLocation())) {
            event.setCancelled(true);
        }
    }

}```The problem with this is that as soon as players leave the region they can't get back in, could you help me find a way to prevent players from leaving a region as if there were a wall in front of them?

quasi flint
#

Öhm

quasi flint
#

U Sure the Plugin is Setup correctly

burnt current
#

which constructor do you mean?

quasi flint
#

Not construxtor

#

Ur Main function

#

Because of does Not find Java Plugin class

burnt current
#

you mean because my Main has the name "Main"?

quasi flint
#

For some IDS reason

quasi flint
#

Sure u Made IT correctly

burnt current
#

yes

quasi flint
#

Because it seems like it's not an valid plugin

#

Could u supply the whole main class

#

With that it extends etc

burnt current
#

i made it with intellij and it does that automatically

#

yes

quasi flint
#

Well that's just wrong

#

Look at my link please

#

I send

#

That's how u setup a blank spigot plugin

#

From what I can see u did that wrong

burnt current
#

as I said. You can make it automatic in Intellij with the Minecraft extension and that's what I did. Everything has worked so far

unreal quartz
#

then u made it wrong

quasi flint
#

Well then it's not making sense that it's complaining about not finden the JavaPlugin class

#

finding

#

Please send main class

#

Via pastebin or hastebin

unreal quartz
#

the entry point of a plugin is not main(String[] args) because it is not a traditional java application

quasi flint
#

It's @Override
public void onEnable()

#

Etc

glad badger
#

eh, if it worked before, I'd make sure that both the plugin or dependency support the same compilation jdm. I have no clue what you are talking about, though, so I'ma stay outta this xD I just know I've had to update quite a few things in some some projects due to it not 'finding classes' only cause I was compiling in a newer version and needed to update my dependencies.

quasi flint
#

When using maven: Added dependencies correctly?

#

Shaded em?

glad badger
#

Asking me? Yes. Just, for example, lombok didn't compile with me in 8.12 version, but changing it to 8.20 did due to java version.

quasi flint
#

Nah

#

Asked him

glad badger
#

got it

quasi flint
#

That is looking ok

burnt current
quasi flint
#

U use maven?

unreal quartz
#

when you say "run" are you literally running that method from within your IDE

quasi flint
#

And this not work

burnt current
#

yes

winged anvil
burnt current
#

i wanted to print the content from my main in the console of my IDE

unreal quartz
#

well of course that is not going to work

#

bukkit is not present in your runtime

winged anvil
#

yo lmb, you think I could send instructions to other servers through a database

unreal quartz
#

that sounds like a terrible idea but there is no reason why you can't

quasi flint
#

Sound dope

#

Insure as hell tho

winged anvil
#

i can’t use messaging cause there’s not gonna be players on my second server

#

i’m trying to get a group of players on a lobby server, then once they’re all together i wanna send instruction to my second server to then get the game setup

unreal quartz
#

if you can't use the PMC then consider a messaging queue like rabbitmq or redis or a socket based setup

winged anvil
#

ight i’ll look into it

burnt current
torn shuttle
#

uh is there a vanilla mc console command that allows me to dm a player as console?

unreal quartz
#

/w ?

torn shuttle
#

tell and msg won't let me do it

#

nope

unreal quartz
#

probably not then other than tellraw

torn shuttle
#

uh really

unreal quartz
#

well i know tellraw can be used from commandblocks so i do not see why the console can't

torn shuttle
#

ah found the issue

#

other plugin was highjacking tell

burnt current
# unreal quartz bukkit is not present in your runtime

ok so I would like to use the whole thing for my MySQL database. But somehow it doesn't work and I don't know if the config is simply not being read or if some other error is to blame... so I tried to test whether the readout works like this

unreal quartz
#

so stick it in your onEnable and test it like any other plugin

burnt current
#

you mean I should try the sysout there?

unreal quartz
#

yes

burnt current
#

okay

#

OK, funny, it is actually being read out

onyx fjord
#

y, how do you push github action

#

run*

sly bison
#

Maybe this sounds dumb, but is there any way for me to see if a float variable was set/updated if that makes sense

float example; // By default the value is '0.0'

if () { // Check if variable 'example' was not set/updated
    // Execute code if true
}

// Later down the line, variable 'example' is updated & possibly can be 0
unreal quartz
#

you can't leave a primitive uninitialized in java

onyx fjord
#

bruh

unreal quartz
#

have a boolean somewhere or something as a flag for if you do set the float

onyx fjord
#

okay i yeeted it from someone

#

nobodys gonna know

sly bison
#

You can't, seemingly I can for some reason? This is Java 8

unreal quartz
#

it is not uninitialized, the JVM will initialize it to 0

#

if you attempt to use an 'uninitialized' local variable then your program won't compile

fallow hearth
onyx fjord
#

what is the maven path to where artifacts are?

sly bison
#

Thanks guys for the info/help

unreal quartz
onyx fjord
#

what

#

i have a workflow

#

that runs mvn package

unreal quartz
#

yes

onyx fjord
#

No files were found with the provided path: target/*.jar. No artifacts will be uploaded 😦

fallow hearth
#

@sly bison Might want to look at Observables as well but thats a lot more advanced

fallow hearth
#

And you cancel the original PacketPlayOutNamedEntitySpawn for the player entity?

#

should work with cancelling the original PacketPlayOutNamedEntitySpawn and replacing it. But keep in mind that approach might crash the client because some packets might contain unexpected data as they are intended for a player object and not a mob

#

The PacketPlayOutPlayerInfo will be sent as well to show tablist-info. Did you look at that as well? That one needs modification at least to spawn fake-players

fading lake
#

(that being replacing the player, otherwise detection of hte new load is PacketPlayOutNamedEntitySpawn)

quaint mantle
#
private UUID lastJoined = null;

@EventHandler
public void onPlayerJoin(PlayerJoinEvent event) {
    lastJoined = event.getPlayer().getUniqueId();
}
#

save to a config on disable

young knoll
#

There is also player.hasPlayedBefore if you only want new players

fallow hearth
#

It will fail in the same tick afair. Try to just increase the ID by 1. Im pretty sure there is no limit in 1.17 at least.
I tested exactly that for my system just recently

#

so PacketPlayOutEntityDestroy + spawn within the same tick will fail