#help-development

1 messages · Page 2217 of 1

formal bear
#

how to check if block.getType() is one item from list of materials?

covert karma
#

if (list.contains(block.getType()))

formal bear
#

forgor about contains tysm

covert karma
#

bruh

primal zodiac
#

Yes

ivory sleet
#

?services @primal zodiac

undone axleBOT
pastel juniper
#

I want to create a msg plugin, but I don't know how to get the text without taking the target
/msg ANFFGaming Some Text

wintry badger
#

hi, how can i check if a player has a certain permission? Player.hasPermission checks if it has a perm contains the given parameter

pastel juniper
formal bear
#

is it working rn?

formal bear
#

How to add Material to list?
List<Material> blocks = List.of(Material.STONE); blocks.add(Material.Example);

pulsar vessel
#
[13:54:43 WARN]: An exceptionCaught() event was fired, and it reached at the tail of the pipeline. It usually means the last handler in the pipeline did not handle the exception.
java.lang.RuntimeException: Unable to access address of buffer
    at io.netty.channel.epoll.Native.read(Native Method) ~[patched_1.8.8.jar:git-PaperSpigot-445]
    at io.netty.channel.epoll.EpollSocketChannel$EpollSocketUnsafe.doReadBytes(EpollSocketChannel.java:678) [patched_1.8.8.jar:git-PaperSpigot-445]
    at io.netty.channel.epoll.EpollSocketChannel$EpollSocketUnsafe.epollInReady(EpollSocketChannel.java:714) [patched_1.8.8.jar:git-PaperSpigot-445]
    at io.netty.channel.epoll.EpollSocketChannel$EpollSocketUnsafe$3.run(EpollSocketChannel.java:755) [patched_1.8.8.jar:git-PaperSpigot-445]
    at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:380) [patched_1.8.8.jar:git-PaperSpigot-445]
    at io.netty.channel.epoll.EpollEventLoop.run(EpollEventLoop.java:268) [patched_1.8.8.jar:git-PaperSpigot-445]
    at io.netty.util.concurrent.SingleThreadEventExecutor$2.run(SingleThreadEventExecutor.java:116) [patched_1.8.8.jar:git-PaperSpigot-445]
    at java.lang.Thread.run(Thread.java:833) [?:?]
#

so this is a error that is spammed in my console every time i try to connect to the server via bungeecord

#

its 1.8.8 server in bukkit.yml the connection throttel thing is at -1 in spigot.yml bungecord is set to true and in server.properties online mode is set to false and in the proxi its the the second in priority and ip forwarding is true and its on the correct port

#

its the first 1.8.8 server im releasing on to my network and for some reason this is giving me a issue however all the over servers on the network work just fine

quaint mantle
#

Hey, so i again have an little problem.
(cant copy the code with correct indent, that why i send an image link)

https://imgur.com/a/ceFyWhS

it works but it gives out the whole log file and spams the whole chat.
what i want:
only the latest line of the log.

#

how would i do this?

formal bear
#

add continue for not last line?

quaint mantle
#

yea but how do i get the last line? how should java/the code know what the latest line is?

gleaming olive
#

How can I calculate damage ?
player.damage() just damages the player without checking for armor points and enchantments... in 1.8

formal bear
#

damagemodifer armor then substract it from damage value?

gleaming olive
#

I am on 1.8

wintry badger
#

hi, hasPermission method returns always true if the player is OP. is there any workaround for it? or do i have to get a full list of the perms and then check for the specific perms?

#

default: false in plugin.yml will work?

#

but what if the plugin contains an integer?

#

keepinventory.partially.30 for example

summer scroll
summer scroll
rare flicker
#

other crappy but probably functional way that everybody will hate :

  • check if he's OP
  • if so Deop
  • check perm
  • if was opped, reop
summer scroll
#

yikes

rare flicker
#

i mean, it works, its really not how its meant to be used

#

but it SHOULD work

summer scroll
#

The better solution is to organize your groups on the permission plugin and avoid use op

rare flicker
#

^^^^

#

Unrelated :

What would be the best way to store an itemstack as text format. I've looked a bit into serialization but i'm not sure if there's an API way of doing it or if you have to use serialization

#

Given i need to store EVERYTHING, so, NBT data, lore, tags like HIDE_ENCHANTMENTS, durability etc

summer scroll
#

Maybe base64?

tardy delta
#

ItemStack#serialize?

#

is that a thing?

rare flicker
#

i think it is, i'm just not too sure if its the best way

summer scroll
#

ItemStack is configuration serializable yes

rare flicker
#

then i just loop through every element in the hashmap and store it in text format?

wind sphinx
#

Check if a player can build in a specific location

formal bear
#

How to add element to List?

List<Material> test = new ArrayList<>();
test.add(Material.GRASS_BLOCK);

Code above does not work

harsh totem
#

If I have a file named "data.json" in a plugin's resource folder, would it's path be just "data.json"?

tardy delta
#

new File(plugin.getDataFolder(), "data.json")

#

or new File(plugin.getDataFolder() + File.separator + "data.json")

harsh totem
#

ok i'kk try

#

i'll*

wind sphinx
harsh totem
#

@tardy delta thank you!

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.

tardy delta
#

ofc it doesnt work, there is no add method which takes 0 params

formal bear
#

it does not work with test.add(Material.GRASS_BLOCK) either

warm saddle
#

How would I get the block that a player has walked on from a PlayerMoveEvent?

#

like the block type?

tardy delta
#

get the block under the location of the players feet

#

player.getLocation().getRelative(BlockFace.DOWN) or smth

pastel juniper
#

I created a claim system, but when I want do to disable pvp for all player except the chunk owner and op, it doesn't work

 @EventHandler
    public void onPvPInteract(EntityDamageEvent event){
        if(event instanceof Player){
            Entity player = event.getEntity();
        if(player.getLocation().getBlock() != null){
            Chunk chunk = player.getLocation().getBlock().getChunk();
            if(ClaimSystem.isChunk(chunk)) {
                UUID uuid = player.getUniqueId();
                if (ClaimSystem.getBD(chunk) == true) {
                    if (!(ClaimSystem.getOwner(chunk, uuid).equals(player.getUniqueId()))) {
                        if (!(player.isOp())) {
                            event.setCancelled(true);
                            player.sendMessage("You are not allowed to break here.");
                        }
                    } else {
                        event.setCancelled(false);
                    }
                }
            }
        }
    }
    }
tardy delta
#

tf

#

early returns

harsh totem
#

why does it get this error? Caused by: java.lang.ClassCastException: class java.lang.Long cannot be cast to class java.lang.Integer (java.lang.Long and java.lang.Integer are in module java.base of loader 'bootstrap')

the value that's supposed to be returned is integer and it is in the json file

        JSONParser parser = new JSONParser();
        try (Reader reader = new FileReader(plugin.getDataFolder() + File.separator + "data.json")) {
            JSONObject jsonObject = (JSONObject) parser.parse(reader);
            return (int) jsonObject.get(key);
        } catch (IOException e) {
            e.printStackTrace();
        } catch (ParseException e) {
            throw new RuntimeException(e);
        }
        return -1;
    }```
tardy delta
#

cast it to a long and then to an int idk lol

ivory sleet
#

cast to Long and use intValue

#

Or the opposite

#

Integer -> longValue etc

rare flicker
rare flicker
#

YamlConfiguration has a .getItemstack(String) method, and you can also .set(Itemstack). Just let it handle everything

west crag
#

hey can anyone tell me which method will be good to increase difficulty of game?

If someone use this command /easymode then less mob should spawn and all code for this function will go to this method :- ```java
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
if(command.getName().equalsIgnoreCase("easymode")) {

        if (sender instanceof Player) {
            - - - code - - -
        }
    }

or should i make new class or new method for this? and then call it from this method?
west crag
#

no

#

that was an example just

#

its going to be something else

west crag
tardy delta
#

¯_(ツ)_/¯

west crag
#

:)

#

no really it will help me :)

#

i will use this in mob spawning stuff

sinful rapids
#
player.getInventory().addItem(a);

not work, i use java11 and server spigot 1.12.2. gives me player in red

#

variables

west crag
#

show your code + error :)

sinful rapids
west crag
#

instance of Player

glass mauve
tardy delta
#

?learnjava

undone axleBOT
sinful rapids
#

error:
java: cannot find symbol
symbol: variable player
location: class me.gabryosas.commandi.AsciaVDF

west crag
tardy delta
#

we just told you

sinful rapids
manic crown
#

idk if this is the right channel for that, but am I allowed to Upload Paper Plugins to Spigotmc.org?

manic crown
#

okay, thank you

drowsy helm
#

if it doesnt use paper only api, yes

manic crown
#

and where do I upload it if there are paper only things?
without github...

tardy delta
#

paper site

drowsy helm
#

i think paper has hangar

manic crown
#

okay...

quiet ice
#

hangar isn't really a thing yet however

drowsy helm
#

you can just make a spigot port

quiet ice
#

I think you can also just upload them to bukkitdev, they do not care about the difference anymoree

ivory sleet
harsh totem
#

how do I check if a raid was finished because the players won and not because the player's lost with RaidFinishEvent?

#

because RaidStopEvent isn't executed when the raid is won

main dew
#

How I can disable create end portal like this?

tardy delta
#

and before complaining that you dont know what those enum constants mean check the docs

harsh totem
# tardy delta check the result

there is no result in raidFinish.
i tried to use result in raidStop but the entire event is only executed when the players lose for any reason

tardy delta
harsh totem
#

i tried to use result in raidStop but the entire event is only executed when the players lose for any reason

tardy delta
harsh totem
#

i know what is says i just read it

#

i checked and it isn't executed when it's won

#

i did the same check one time winning and one time losing and nothing happened when i won

tardy delta
#

it should lol, did you register it?

harsh totem
#

yes

eternal oxide
#

Have you also checked the Raid Stop Event?

harsh totem
#

I have this @EventHandler public void Hero(RaidStopEvent event) { Player ytg667 = Bukkit.getPlayer("YTG667"); ytg667.sendMessage(event.getRaid().getLocation().toString());
when i win nothing is printed. when i lose it's printed

tardy delta
#

method names should start with a lowercase character.. again...

harsh totem
#

why does it matter

tardy delta
#

because conventions

glass mauve
#

you also hardcoded the player

eternal oxide
#

Makes it easier for everyone else to read your code

tardy delta
#

it would throw anyways otherwise

eternal oxide
#

a Capital letter indicates that is a Class not a method

harsh totem
#

its for debugging

glass mauve
#

isnt there no event.getPlayers or smth like that?

#

let me look in the docs

eternal oxide
#

I would assume RaidFinishEvent would fire fora win only

#

RaidStopEvent seems like it would fire if the raid was lost

tardy delta
#

dunno what clear result means

eternal oxide
#

actually RaidStopEvent would fire always

harsh totem
glass mauve
quasi patrol
#

It is only triggering for command argument tab completing, not the actual command itself tab completion.

glass mauve
#

both RaidStopEvent and RaidFinishEvent inherit from RaidEvent

eternal oxide
glass mauve
#

RaidFinishEvent is for VICTORY

#

cause there is a getWinners() method which returns a List of Player

quasi patrol
eternal oxide
#
Note that due to client changes, if the sender is a Player, this event will only begin to fire once command arguments are specified, not commands themselves. Plugins wishing to remove commands from tab completion are advised to ensure the client does not have permission for the relevant commands, or use PlayerCommandSendEvent.```
tardy delta
#

just dont give them permission to execute the command

#

¯_(ツ)_/¯

eternal oxide
#

Yep, no permission it won;t be in their command list

sterile cloak
#

Hello, anyone can help mi with that? I want to change every link sended by player in chat change to my link, i know, i need to to that with AsyncPlayerChatEvent and regex but i don't have idea how (and i mean replacing by converting url to another based on url so example: String originalurl = ""; byte[] enc = originalurl.getBytes(); String encoded = Base64.getEncoder().encodeToString(enc); String replacedurl = "https://nonexist.nonexist/something.php?=" + encoded + "";

sterile cloak
eternal oxide
#

It literally gives you the regex to find ANY url and replace it

sterile cloak
#

but it must replace exactly from original url

#

converted

eternal oxide
#

what?

#

you have an incoming String in teh getMessage(). Perform replaceAll with that regex

sterile cloak
#

yes but how exactly replace every url with new converted url?

#

you readed my example to convert?

eternal oxide
#
String regex = "(https?|ftp|file)://[-a-zA-Z0-9+&@#/%?=~_|!:,.;]*[-a-zA-Z0-9+&@#/%=~_|]";

//in Event

event.setMessage(event.getMessage().replaceAll(regex, "http://yoururl.com"));```
sterile cloak
#

i know about that

#

problem is detection original url

#

because that must be converted

eternal oxide
#

what must be converted? The getMessage() should be in plain text

sterile cloak
#

for understanfing: player in chat send message with example: https://www.youtube.com and i need that url replaced by my url but original player url must be converted to base64

eternal oxide
#

why muist it be converted?

sterile cloak
#

url that player sended

eternal oxide
#

if you want to encode then encode it Base64.encode

#

why?

sterile cloak
#

because of web api

eternal oxide
#

I don;t understand what Base64 encoding has to do with anything

mortal hare
#

Its easier to send data in Base64 than in binary form

eternal oxide
#

ok, lets start over. You asked how to replace all player entered web links with yours.

sterile cloak
#

yes but every that link must be separatelly converted

eternal oxide
#

why?

sterile cloak
#

because of web api

eternal oxide
#

web api has nothign to do with player chat

sterile cloak
#

yes, it has, because of ad link

eternal oxide
#

I'd suggest you go reformat your question as you are only giving broken pieces of it.

sterile cloak
#

my english isn't perfect, that is true

eternal oxide
#

web api and ad link are nothing to do with your original question

sterile cloak
#

so converted chat link -> my web -> linkvertise -> final target link

eternal oxide
#

Are you wanting to do something with the web links that the player has entered?

sterile cloak
#

that's the point, replacing original links

eternal oxide
#

Then compile a Pattern from the regex and you can process each match

sterile cloak
#

i know, i need to do that but I'm really bad in regex

eternal oxide
#

search regex pattern matching

#

you already have the regex

sterile cloak
#

yes

eternal oxide
#

you literally create a Pattern from it

#

then loop any matches

sterile cloak
#

and that's the problem, how?

#

how to exactly do that specific operation i want

eternal oxide
sterile cloak
#

i don't understand that regex, I'm literally self-learned but regex is not my part ....i tried exactly use that ..... don't worked

eternal oxide
#

?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.

ivory sleet
#

yes regex is well... interesting to say the very least

ivory sleet
#

since that'd compile it every time you invoke it

sterile cloak
#

I'm tried to that and don't worked ... I'm literally don't understand regex

#

oh... i can't send image

subtle folio
#

i didnt know you could make projectiles bounce lmfao

ivory sleet
sterile cloak
#

i literally don't have idea, how to do that i want

tardy delta
#

store the pattern as a field

#

regex slow

ivory sleet
#

ye if you have to compile it every time

eternal oxide
#

Not tested, but somethign like ```java
Pattern patern = Pattern.compile("(https?|ftp|file)://[-a-zA-Z0-9+&@#/%?=~|!:,.;]*[-a-zA-Z0-9+&@#/%=~|]");

public void findURL(String message) {
    
    Matcher match = patern.matcher(message);
    
    int count = 0;
    
    while (match.find()) {
        System.out.println("Found: " + match.group(count));
        count++;
    }
}```
tardy delta
#

why getting the bytes of a stringbuffer.toString?

#

dont even know what a stringbuffer is lol

quiet ice
#

Don't use StringBuffers

#

StringBuilders are almost always more appropriate

ivory sleet
#

^they're badly optimized due to "antique" thread safety

quiet ice
#

But in this case the allocation is superfluous as you'd really want to call String#getBytes

hybrid spoke
quiet ice
#

StringBuilders on the other hand are the best shit out there

hybrid spoke
#

hah, y'all need a builder to make a string?

#

i just do ""

formal bear
#

where i can find list of minecraft sounds with preview

hybrid spoke
#

?bing

undone axleBOT
quiet ice
#

That used to internally create a StringBuilder

ivory sleet
quiet ice
#

JIT probably optimises a fair bit there, but using a shared StringBuilder instance is rather neat

ivory sleet
#

IntrinsicCandidate ;**

subtle folio
#

Is it possible to set a Entity's bounding box?

#

so like they can only walk inside that area?

quiet ice
#

That is a very strange definition of bounding box

subtle folio
#

lmfao Im not exactly sure how to even use it so

quiet ice
#

Or at least not the traditional connection

hybrid spoke
#

well

quiet ice
#

It is the right term, yes

hybrid spoke
#

what are you trying to do

eternal oxide
#

call it a region (BoundingBox) 🙂

subtle folio
#

Im trying to allow mobs to only walk within a certain area of their spawn

hybrid spoke
#

ohh i thought of a hitbox

crimson terrace
quiet ice
subtle folio
crimson terrace
pastel juniper
#

I disabled door opening with this :

block.getState().getData() instanceof Openable

But still can open Crimson and Warped doors

crimson terrace
#

every second I go through the entities Ive assigned a bounding box to and check

subtle folio
#

every second 😳

crimson terrace
#

yes

#

not every tick

subtle folio
#

wouldn'

quiet ice
#

You can spread out the workload across multiple ticks anyways

subtle folio
#

yeah

tardy delta
crimson terrace
#

you could yeah. for my purposes its not necessary tho. at least not for the targetted servers

subtle folio
#

hmm okay

#

that bounding box contains the entities bounding box
Could you explain this to me? @crimson terrace

crimson terrace
#

BoundingBox#contains(BoundingBox boundingBox)

subtle folio
#

Uhuh

crimson terrace
#

any problem?

subtle folio
#

How do I set a zombie's bounding box?

crimson terrace
#

a boundingbox is a hitbox basically

#

you dont set them

subtle folio
#

OHHH

crimson terrace
#

you have to make another bounding box and check whether the zombies box is inside the big one

subtle folio
#

So I should make a bounding box that get init'd onenable for their allowed locations

crimson terrace
#

ye

sinful rapids
#
            Player player = (Player) sender;
            ItemStack ascia = new ItemStack(Material.IRON_AXE, 1);
            ItemMeta ascianame = ascia.getItemMeta();
            ascianame.setDisplayName("§cAscia VDF");
            ascia.setItemMeta(ascianame);
            ascia.addEnchantment(Enchantment.DURABILITY, 1);
            player.getInventory().addItem(ascia);
            player.sendMessage("§7[§cVDF CORE§7] §7Ascia givvata con successo!");
            

give me a stone axe don't axe iron, how can I solve?

tardy delta
#

doesnt make sense

eternal oxide
#

It would probably be cheaper to just set a tether range

tardy delta
#

have you restarted your server with the new plugin?

sinful rapids
#

yes

subtle folio
crimson terrace
#

the code you sent gives you an iron axe, the problem must lie somewhere else

crimson terrace
sinful rapids
#

nope

#

always iron

crimson terrace
#

then you have different code which gives you a stone axe

#

you on intelliJ?

sinful rapids
crimson terrace
#

hit ctrl shift F and search for "STONE_AXE"

sinful rapids
#

ok

crimson terrace
#

if there is none, build the project again and put the new jar file back into the server, then restart it

sinful rapids
#

There is not

loud junco
#

What do you think is better to use, CompletableFuture.runAsync or Bukkit.getScheduler().runTaskAsynchronously and why? Been thinking about what to use, as i'm not sure if the Bukkit Scheduler works the same as CompletableFuture.. Does it? 😄

ivory sleet
#

Doesn’t really matter if you supply the cf with a good executor

#

In java 19 the runAsync will be better in combination with virtual threads

loud junco
#

I just plan to fill my cache with data from mysql with it.

ivory sleet
#

Since runTaskAsync probably will stay as is with the cached thread pool

ashen quest
#

hey guys, i wanna do smth like

- every 24 hours, X player's progress resets
  - which contains
    - all the blocks they placed turning into the block that was previously there
    - there items be gone (i know how to do this)

now how do i store all blocks placed by the player effeciently

as this could get messy with like 50 players

sinful rapids
eternal oxide
ashen quest
eternal oxide
#

Then store changes in a database

ashen quest
#

What DB would u recommend

#

MySQL or Mongo?

eternal oxide
#

sqlite would be fine for 50 players

ashen quest
#

no but the problem is also resetting

eternal oxide
#

why?

ashen quest
#

cuz imagine i m resetting for 10 players, all of them have like 200 blocks
and now all of a sudden i m replacing so many blocks

#

wont that make the server a bit slow?

#

at that time no one will be online if that helps

quiet ice
ashen quest
#

whats the long for

quiet ice
#

The old location

#

(it would be a bitset)

ashen quest
#

Okay

#

hmm now shit gets messy

#

cuz theres container blocks

ashen quest
quiet ice
#

If you are on paper you might be able to pass it through DFU

brave sparrow
#

What happens if a non-reset player interacts with a block scheduled to be reset?

ashen quest
#

it just stays how the non reset player decided to

ashen quest
#

will remove it from the db

ashen quest
loud junco
#

what data do you think will get reset? 😄 you won't clear players inventories if you delete the world

quiet ice
#

Well if you player sets a block twice at a certain position and this thing

ashen quest
#

yea i m not deleting the world

quiet ice
#

Oh yeah, and your idea does open up the window for dupes

ashen quest
#

oofus

#

ty for the info gtg

main dew
#

don't work 😅

dusty herald
#

what do you mean it don't work?

tardy delta
#

registered it?

median trench
#

I imported spigot remapped to mojang nms into my project and I get this error right here: java.lang.NoClassDefFoundError: net/minecraft/nbt/Tag, I tried using both reobfuscated and not reobfucated in the server.

I have checked that both the server and the plugin use the same nms version

pale egret
#

Has anyone here used sparked host

tardy delta
main dew
median trench
eternal oxide
#

can;t help you then

#

Maven is simple using special source plugin

median trench
ashen quest
sinful rapids
#
            Player player = (Player) sender;
            ItemStack stivale = new ItemStack(Material.LEATHER_BOOTS);
            ItemMeta stivalename = stivale.getItemMeta();
            LeatherArmorMeta o = (LeatherArmorMeta)stivale.getItemMeta();
            o.setColor(Color.RED);
            stivale.setItemMeta(o);
            stivalename.setDisplayName("§cStivale VDF");
            player.getInventory().addItem(stivale);

not work displayname

ashen quest
#

u arent setting the item meta back

hoary wing
#

could anyone write a plugin for me that sets the item in the 9th hotbarslot to item{CustomModelData: 11112222} with 1111 being (x-location of the player+6000)/10 and 2222 being the (z-location of the player+6000)/10 , (doesnt really matter what the item is

ashen quest
#
stivale.setItemMeta(stivalename);
#

?services

undone axleBOT
ashen quest
#

we dont write stuff for you, u can find devs here tho ^

median trench
sinful rapids
# ashen quest ```java stivale.setItemMeta(stivalename); ```
            Player player = (Player) sender;
            ItemStack stivale = new ItemStack(Material.LEATHER_BOOTS);
            ItemMeta stivalename = stivale.getItemMeta();
            LeatherArmorMeta o = (LeatherArmorMeta)stivale.getItemMeta();
            stivalename.setDisplayName("§cStivale VDF");
            o.setColor(Color.RED);
            stivale.setItemMeta(stivalename);
            stivale.setItemMeta(o);
            player.getInventory().addItem(stivale);

this?

tardy delta
#

LeatherArmorMeta o = (LeatherArmorMeta)stivale.getItemMeta();

ashen quest
#

yes

tardy delta
#

you already made a variable for the meta

ashen quest
#

yea i dont understand why u are using two metas

quaint mantle
#

Someone has a good vector tutorial?

mighty pier
#

so i have arraylist of player:number. how can i sort highest to lowest

halcyon mica
#

Is it possible to render the nametag of a entity without the black backdrop?

#

Or generally, display text without a background

mighty pier
#

n o

halcyon mica
#

Weirdly agressive answer, but alright

formal bear
#

How to convert string as hex "#f125e5" to Color as RGB?

#

For example fireworks color

quaint mantle
#

i thought someone made that already and had public it?

quasi patrol
#

First time using PlayerInteractEvent, how do I prevent this crash error?


at net.minecraft.world.item.ItemStack.P(ItemStack.java:194) ~[spigot-1.19-R0.1-SNAPSHOT.jar:3528-Spigot-56be6a8-031eaad]

at net.minecraft.world.item.ItemStack.e(ItemStack.java:1190) ~[spigot-1.19-R0.1-SNAPSHOT.jar:3528-Spigot-56be6a8-031eaad]

at net.minecraft.server.level.PlayerInteractManager.a(PlayerInteractManager.java:453) ~[spigot-1.19-R0.1-SNAPSHOT.jar:3528-Spigot-56be6a8-031eaad]

at net.minecraft.server.network.PlayerConnection.a(PlayerConnection.java:1655) ~[spigot-1.19-R0.1-SNAPSHOT.jar:3528-Spigot-56be6a8-031eaad]

at net.minecraft.network.protocol.game.PacketPlayInBlockPlace.a(PacketPlayInBlockPlace.java:32) ~[spigot-1.19-R0.1-SNAPSHOT.jar:3528-Spigot-56be6a8-031eaad]

at net.minecraft.network.protocol.game.PacketPlayInBlockPlace.a(PacketPlayInBlockPlace.java:1) ~[spigot-1.19-R0.1-SNAPSHOT.jar:3528-Spigot-56be6a8-031eaad]

at net.minecraft.network.protocol.PlayerConnectionUtils.lambda$0(PlayerConnectionUtils.java:31) ~[spigot-1.19-R0.1-SNAPSHOT.jar:3528-Spigot-56be6a8-031eaad]

at net.minecraft.server.TickTask.run(SourceFile:18) ~[spigot-1.19-R0.1-SNAPSHOT.jar:3528-Spigot-56be6a8-031eaad]

at net.minecraft.util.thread.IAsyncTaskHandler.d(SourceFile:157) ~[spigot-1.19-R0.1-SNAPSHOT.jar:3528-Spigot-56be6a8-031eaad]

at net.minecraft.util.thread.IAsyncTaskHandlerReentrant.d(SourceFile:23) ~[spigot-1.19-R0.1-SNAPSHOT.jar:3528-Spigot-56be6a8-031eaad]

at net.minecraft.server.MinecraftServer.b(MinecraftServer.java:1150) ~[spigot-1.19-R0.1-SNAPSHOT.jar:3528-Spigot-56be6a8-031eaad]

at net.minecraft.server.MinecraftServer.d(MinecraftServer.java:1) ~[spigot-1.19-R0.1-SNAPSHOT.jar:3528-Spigot-56be6a8-031eaad]

at net.minecraft.util.thread.IAsyncTaskHandler.x(SourceFile:131) ~[spigot-1.19-R0.1-SNAPSHOT.jar:3528-Spigot-56be6a8-031eaad]

at net.minecraft.server.MinecraftServer.bh(MinecraftServer.java:1129) ~[spigot-1.19-R0.1-SNAPSHOT.jar:3528-Spigot-56be6a8-031eaad]

at net.minecraft.server.MinecraftServer.x(MinecraftServer.java:1122) ~[spigot-1.19-R0.1-SNAPSHOT.jar:3528-Spigot-56be6a8-031eaad]

at net.minecraft.util.thread.IAsyncTaskHandler.bq(SourceFile:116) ~[spigot-1.19-R0.1-SNAPSHOT.jar:3528-Spigot-56be6a8-031eaad]

at net.minecraft.server.MinecraftServer.w(MinecraftServer.java:1105) ~[spigot-1.19-R0.1-SNAPSHOT.jar:3528-Spigot-56be6a8-031eaad]

at net.minecraft.server.MinecraftServer.v(MinecraftServer.java:1014) ~[spigot-1.19-R0.1-SNAPSHOT.jar:3528-Spigot-56be6a8-031eaad]

at net.minecraft.server.MinecraftServer.lambda$0(MinecraftServer.java:291) ~[spigot-1.19-R0.1-SNAPSHOT.jar:3528-Spigot-56be6a8-031eaad]

at java.lang.Thread.run(Thread.java:833) [?:?]```
earnest forum
#

this doesnt show the actual error

#

please copy the whole thing in

#

?paste

undone axleBOT
subtle folio
#

new Thread(() -> Bukkit.getScheduler().runTaskTimer(Tazpvp.this, MobUtils::everySec, 20, 20)).start(); 🤓 thread

earnest forum
#

im pretty sure getList doesnt return a list of locations

#

probably a list of objects

sinful rapids
#

How does Armor Wear Event spigot work?

subtle folio
earnest forum
#

triggers whenever armour is equipped

eternal oxide
#

There is no Armor wear event in Spigot

subtle folio
eternal oxide
#

Theres no wear or equip event in Spigot

sinful rapids
subtle folio
#

PlayerChangedArmorEvent

#

same difference

eternal oxide
#

Not in Spigot

earnest forum
#

the full error

#

thats not the full error

#

thats just the stack trace

#

should say something ending with Exception

silver pulsar
pale egret
#

is 3.4ghz and 3.7ghz turbo good for a minecraft server?

halcyon mica
#

Better question, what angles do I have to set the head pose of a armorstand to so that the angle is isometric when looked at from dead-center front

quasi patrol
earnest forum
#

🤦‍♂️

#

start to finish error

quasi patrol
earnest forum
#

looks like ur server is broken

#

update the jar?

earnest forum
#

well the stack trace doesnt point to a spigot plugin

#

its all nms

#

wdym

paper falcon
#

nvm

elder birch
#

int diff = mobCap - entities.size();
if (diff <= 0) return;

            int spawnAmount = (int) (Math.random() * (mobCap + 1)), count = 0;
            while (count <= spawnAmount) {
                count++;
                int ranX = getRandomWithNeg(size), ranZ = getRandomWithNeg(size);
                Block block = world.getHighestBlockAt(ranX, ranZ);
                Location loc = block.getLocation().clone().add(0, 1, 0);

                entities.add(world.spawnEntity(loc, EntityType.ZOMBIE));
            }
        }

    }.runTaskTimer(this, 0L, spawnTime);
}
#

second line , forth line and run.TaskTimer(this, 0L, spawnTime) are coming back wrong

#

also it says that the last 2 curly brackets need a ;

pastel juniper
#

Is there a way to get sheep's color

pale egret
#

is 40gb ssd enough for a server

elder birch
#

yea

#

if thats all u got on it

#

just the server

pale egret
#

like for plugins too

elder birch
#

yup

earnest forum
#

depends on the type of server

#

if its an smp

elder birch
#

fair

earnest forum
#

u need more space

elder birch
#

but like an smp will take up 10-25gb at a streach

naive bolt
elder birch
#

int diff = mobCap - entities.size();
if (diff <= 0) return;

            int spawnAmount = (int) (Math.random() * (mobCap + 1)), count = 0;
            while (count <= spawnAmount) {
                count++;
                int ranX = getRandomWithNeg(size), ranZ = getRandomWithNeg(size);
                Block block = world.getHighestBlockAt(ranX, ranZ);
                Location loc = block.getLocation().clone().add(0, 1, 0);

                entities.add(world.spawnEntity(loc, EntityType.ZOMBIE));
            }
        }

    }.runTaskTimer(this, 0L, spawnTime);
}

second line , forth line and run.TaskTimer(this, 0L, spawnTime) are coming back wrong
also it says that the last 2 curly brackets need a ;

formal bear
#

Can anyone help me with converting (HEX from config) String #f15c31 to Bukkit Color for example to use it on Armor or Fireworks?

silver pulsar
#

Hi.
I'm trying to store a list of locations and I've used a File to store the data between server restarts. but im having some trouble retrieving and storing the list to a variable. I know that im retrieving the List correctly but when im trying to make it to the variable it breaks.

What ive tried:
public static List<org.bukkit.Location> DrillLocations = new ArrayList<>(); DrillLocations.addAll(FileHandeler.getFile().getList("Cords"));
And:
public static List<org.bukkit.Location> DrillLocations = FileHandeler.getFile().getList("Cords");

eternal oxide
cosmic spear
#

Hi guys its possible autogenerate a yml on bungee?
i have added config.yml on resoruces but don't create it

#

And this create lang.yml in plugins folder
file = new File(ProxyServer.getInstance().getPluginsFolder() + "/lang.yml");

halcyon mica
#

Is there any way to make a nametag smaller?

#

By giving it to a different entity or something?

uneven fiber
#

Hey, I keep getting a null error for my event listener, and I can't figure out why.

#

this is me registering the event

#

Any thoughts?

subtle folio
uneven fiber
eternal oxide
#

Where are you instancing the PlayerKits Class?

eternal oxide
#

your instance you pass is null

tall dragon
#

why not pass this?

river oracle
tall dragon
#

right

sacred mountain
#

how do i use an instanceof in a foreach/predicate

#

entity -> entity instanceof Player
doesnt work so idk

tall dragon
#

those are called lambda's fyi

sacred mountain
#

yeah

#

sry

tall dragon
#

well what ru tryna do

tall dragon
#

that should work fine

#
        List<Entity> list = ...;
        List<Entity> players = list.stream().filter((ent) -> ent instanceof Player).toList();
#

for example

#

this works fine

glass mauve
#

you could also map it to List<Player>

tall dragon
#

yea you could

ivory sleet
#

Player.class::cast (:

#

And ::isInstance

tall dragon
ivory sleet
#

🙂 yeah

#

Oh

#

I can’t do it the other way

tall dragon
#

you can

#

if you disable discord transforming them 😄

glass mauve
#

^

#

:)

#

:D

ivory sleet
#

Let me see

sacred mountain
glass mauve
ivory sleet
#

stream.filter(Class.class::isInstance).map(Class.class::cast)

uneven fiber
#

anyone know how to set the color of some leather pants

sacred mountain
#

that returns a Stream of player, how do i conver thtat to a collection/list

glass mauve
#

.toList()

ivory sleet
#

collect

#

Or toList, depends on what implementation of list you want

glass mauve
#

yea

tall dragon
#

#toList returns an unmodifiable list

small current
#

hello i want to spawn a ender dragon in overworld but it has to support changing phases and having a portal how to do that

#

1.17.1

tall dragon
#

uhh as far as i know enderdragons AI is disabled in overworld

sacred mountain
#

ignore the line at the top, its a duplicate method error

tall dragon
#

so would prolly take some trickery to get arround that

eternal oxide
#

The last time I spawned a dragon in the Overworld it always heads off to 0,0. But that was back in 1.7 days

tall dragon
#

nowaways it just floats still i think

#

iirc

winged ridge
#

I'm trying to parse an Item from an arg on a command, but I get null exception. java try { ItemStack item = new ItemStack(Material.getMaterial(args[1].toUpperCase()), Integer.parseInt(args[2])); } catch (NumberFormatException e) { player.sendMessage(ChatColor.RED + "The item " + args[1].toUpperCase() + "doesn't exist"); }
args[1] isn't null, I can print it

sacred mountain
#

uh

ivory sleet
#

No but getMaterial can return null iirc

sacred mountain
#

Returns:
Material if found, or null

winged ridge
#

yeah but it doens't send the message to the player

ivory sleet
#

Anyway you should favor matchMaterial

tall dragon
#

and the action you take after an exception is wrong too

ivory sleet
#

It’s much kinder

winged ridge
#

ok let me try

tall dragon
#

you send them a message the item doesnt exist

#

while really they didnt enter a correct number

ivory sleet
uneven fiber
#

anyone know how to set the color of some leather pants

tall dragon
#

use LeatherArmorMeta

desert tinsel
uneven fiber
sacred mountain
#

marerial

ivory sleet
sacred mountain
#

matchMaterial

ivory sleet
#

That’ll just explode upon misinput

sacred mountain
#

Attempts to match the Material with the given name.
This is a match lookup; names will be converted to uppercase, then stripped of special characters in an attempt to format it like the enum.

winged ridge
sacred mountain
#

you dont need to worry about uppercasing that

#

then your command args are wrong

ivory sleet
tall dragon
#

make the player input a number and choose a material from the ordinal 😄

ivory sleet
#

ItemStack(null) throws NPE

sacred mountain
#

btw

#

commands args start from 0

#

not 1

ivory sleet
#

Because it doesn’t make sense for the material of said stack to be null

winged ridge
desert tinsel
#

Material.valueOf(args[1].toUpperCase())

sacred mountain
#

mk

sacred mountain
ivory sleet
ivory sleet
#

Yes

#

You should cache matchMaterial into a variable, null check the value of the variable and if not null then continue

sacred mountain
ivory sleet
#

Yes

sacred mountain
#

i tried \d and it doesn't work

glass mauve
#

\d means digit

ivory sleet
#

\d

#

\\d

glass mauve
#

like 0-9

ivory sleet
#

Since you need to escape the escape character

tall dragon
sacred mountain
#

?

ivory sleet
#

Yes

sacred mountain
#

aight

#

i've always used 0-9 ;lol

tall dragon
#

[0-9] will match 0 to 9 as it sais, \d will match any number so also latin numbers and stuff

ivory sleet
#

Latin numbers?

glass mauve
#

I, II, III, IV etc

tall dragon
#

idk there are weird numbers

sacred mountain
#

thats

#

roman numerals

tall dragon
#

those will be matched by \d as well

sacred mountain
#

unless im stupid

tall dragon
#

or i am confused with \w

sacred mountain
#

whats latin numbers

tall dragon
#

XD

ivory sleet
#

Yes you’re

#

\d is literally equivalent to [0-9] by definition

sacred mountain
#

is there a difference

ivory sleet
#

No

sacred mountain
#

ok

ivory sleet
#

They’re equivalent

tall dragon
#

in \w there is a difference tho

ivory sleet
#

Ye

tall dragon
#

between \w and [a-zA-Z]

glass mauve
#

[A-Za-z]

ivory sleet
#

\w is like [a-zA-Z0-9]

sacred mountain
#

thx

tall dragon
#

and it will also match arabic characters and stuff

#

iirc

ivory sleet
#

In Java I don’t think so, maybe tho

#

For Latin shit there’s another one

ashen quest
ivory sleet
#

Like \p{IsLatin} or sth

tall dragon
subtle folio
#

Does ChatColor#of() translate colorcodes like & and hex values?

ashen quest
glass mauve
ivory sleet
#

^

#

Not Arabic then

#

But . can be used

ashen quest
#

btw whats the _ for

ivory sleet
#

&x&f&f&f&f&f&f is equivalent to white

#

For instance

tall dragon
sacred mountain
#

some methods i made to find players, any way to improve or nope

ivory sleet
#

By convention you should use Predicate<? super Player> such that an instance of Predicate<HumanEntity> could be passed

#

But looks fine

#

I would avoid streams

glass mauve
ivory sleet
#

Since they’re not yet competitive with normal loops

sacred mountain
ivory sleet
#

And those methods look like they would be executed arbitrarily during runtime post bootstrap

glass mauve
#

streams are really useful

ivory sleet
#

So are loops

glass mauve
#

but ugly

sacred mountain
#

yes

#

ugly

#

lambdas look hot

ivory sleet
#

You don’t use lambdas cause they’re hot tho

sacred mountain
ivory sleet
#

No

glass mauve
#

well no

hasty prawn
#

I do wdym

sacred mountain
#

lmao

ivory sleet
#

You’d use them because they tend to abstract or avoid side effects

sacred mountain
#
  • they're hot
hasty prawn
#

^

ivory sleet
#

literally doesn’t matter

sacred mountain
#

¯_(ツ)_/¯

opal juniper
#

i use streams cause they make a huge multi step problem a one line issue

ivory sleet
#

Streams as of now scale significantly worse than loops

#

Well if you wanna be clean just extract a method with the loop like any clean coder would do

tall dragon
#

by smile's logic, 1 line = faster 😄

opal juniper
#

they are slower but i accept that

sacred mountain
glass mauve
sacred mountain
#

i mean

#

on a scale of a minecraft plugin

hasty prawn
#

My guess is that in this case the performance difference of streams and loops isn't going to matter.

ivory sleet
#

Yea for bootstrapping and termination it’s fine to use streams

#

But they really suck ass right now when it comes to performance since it has to switch on the terminal operation type and sometimes can’t evaluate lazily

sacred mountain
#

whats the actual speed difference

ivory sleet
#

And + all the extra object allocation

#

Do some benchmarks

sacred mountain
#

nanotime? or is that useles

#

or just system milliseconds

glass mauve
#

but pls use good java benchmarks

ivory sleet
#

But it’s a bit hard to bench mark individual methods as sometimes they’re lazily evaluated

glass mauve
#

use org.openjdk.jmh

ivory sleet
#

Anyway light fury thats what I would say, go with a loop, or at least get rid of the stream, you can create some hacky for each higher order function if you want to

#

if you’re in love with javas lambda syntax ig

sacred mountain
#

aight ok

#

lmao it was a joke

#

but yeah thx

ivory sleet
#

No it’s fine

#

A lot of people have that opinion apparently

glass mauve
#

but the performance difference between forloop and streams are not that high

ivory sleet
#

Depends on how you scale it

#

And what operations you do

tall dragon
#

in some critical systems every little bit counts though

glass mauve
#

but makes code less readable

ivory sleet
#

Like, streams are worse in terms of both space and time

#

No it doesn’t

#

It reduces boilerplate tho

#

But that’s different

lethal roost
#

because my code isn't working the way i think it's supposed to work

eternal oxide
#

In an InventoryClickEvent this would be the InventoryAction if you were putting a stack into a slot.

lethal roost
#

so with this code, it should message the console whenever i place a wooden axe in my inventory, right?

crisp steeple
#

no, you never check what the type of the item is

lethal roost
#

oh yeah right

#

well but any object then

#

ah

#

lemme try that then

#

ty

quaint mantle
#

is getVersion() and getBukkitVersion() the same?

opal juniper
#

no

lethal roost
river oracle
quaint mantle
#

oh okay didn't knew that

#

thanks

river oracle
#

Wrong?

#

What Is version then

opal juniper
#

get version is - Gets the version string of this server implementation.

river oracle
#

Mb

lethal roost
#

and the console doesn't say anything at all with this code even after i tried clicking on a stack of items, one item, etc in my inventory

#

is there a reason for this?

tall dragon
#

nope

#

but for items you can use Nbt as an alternative

#

idk what ur tryna do

high eagle
#

Anybody know what has happened to EpicWorldGenerator, is it still supported?

dire marsh
#

no

high eagle
#

No it's not or you don't know.

#

It say I can still buy it for $20.00USD.

dire marsh
#

the author hasn't cared about ewg for 2 years

dire marsh
#

you can't purchase it

high eagle
#

I know.

#

It's terriblay.

#

Any other alts?

dire marsh
#

terra, realisticworldgenerator, iris

high eagle
lethal roost
#

terra is very good i can confirm 😏

high eagle
#

Dude the .jar name is incredibly long.

#

It looks sorta scuffed.

#

But I know it's safe.

lethal roost
#

ok

sacred mountain
#

ok

high eagle
#

Since nobody else would help me with my server. Would you?

trail lintel
#

Hey guys, I am having some trouble with the getLineOfSight function. I want to only get water SOURCE blocks, but it takes a material list for its "transparent blocks". Well, water is no longer differentiated by the two material types WATER and STATIONARY_WATER, I have to use a Levelled block instance. How can I approach this? My getLineOfSight is returning flowing water blocks, when I want it to look through them =[

#

I'm guessing the only option here might be to use a Raycast with a predicate to filter out the non-source blocks? Would like to stick with getLineOfSight if possible though for simplicity

#

Oh 😮

#

looks like raycast blocks has a FluidCollisionMode option, can take SOURCE_ONLY 😉

dire sand
#

Hey guys

#

I am looking to spawn hollow falling blocks

#

How can I make them hollow?

twilit roost
#

How to get if player is holding A/D key?

trail lintel
#

dont think you can get what keys the player is holding

#

you can tell that they are sneaking or sprinting, thus kinda getting ctrl and shift, im not 100% though there might be a way

twilit roost
#

i thought of MoveEvent
but that can lag the crap out of the server..

ocean lion
#

Does anybody know a good ScoreboardApi?

ivory sleet
#

Define good

green prism
#

Hello guys, I've a question for you. How can I get all the id’s and their relative values in the "Values" column in the form of hashmap<Integer, String> in mysql? Thank you for everything you'll do 🙂

ocean lion
#

Which can be used for viewer specified events such as Duels

sacred mountain
#

fastboard

#

fr.micky

#

maven

dire sand
#

Anyone have an idea on the hollow blocks?

sacred mountain
#

hollow?

#

what is hollow

small current
sacred mountain
#

he said hollow falling blocks

sand turret
#

I'm looking for a plugin that won't allow me to pick up creative from articles, help me pls

sacred mountain
#

what is articles

#

and 'pick up creative'

#

and this also isnt the right channel

#

hey is there any good way to shorten/clean this up?

silver pulsar
#

Hi.
I'm trying to store a list of locations and I've used a File to store the data between server restarts. but im having some trouble retrieving and storing the list to a variable. I know that im retrieving the List correctly but when im trying to make it to the variable it breaks.

What ive tried:
public static List<org.bukkit.Location> DrillLocations = new ArrayList<>(); DrillLocations.addAll(FileHandeler.getFile().getList("Cords"));
And:
public static List<org.bukkit.Location> DrillLocations = FileHandeler.getFile().getList("Cords");

sacred mountain
#

are you sure the path is right

#

what does your yaml look like

silver pulsar
#

yaml:
`Cords:

  • ==: org.bukkit.Location
    world: world
    x: 1.0
    y: 119.0
    z: 0.0
    pitch: 0.0
    yaw: 0.0
  • ==: org.bukkit.Location
    world: world
    x: 0.0
    y: 119.0
    z: 0.0
    pitch: 0.0
    yaw: 0.0
  • ==: org.bukkit.Location
    world: world
    x: -1.0
    y: 119.0
    z: 0.0
    pitch: 0.0
    yaw: 0.0
    Test:
  • Hello
  • World
    LoremIpsum: Test
    `
silver pulsar
sacred mountain
#

don't you need to deserialize

silver pulsar
#

what does that mean?
im new to java

sacred mountain
#

how did you set the locatoin in the config

#

config.set("path", Location)

silver pulsar
#

DrillLocations is a ArrayList of org.bukkit.Location
DrillLocations.add(event.getBlock().getLocation()); FileHandeler.getFile().addDefault("Cords", DrillLocations);

lost matrix
sacred mountain
#

aight ok

#

wdym a map

#

HashMap<String, Object>

#

or <string, string>

lost matrix
#

Either <String, String> or if you want to use the calls instead <String, Supplier<String>>

sacred mountain
#

and just have a getter

#

those values change though,

#

how often do i update this map

#

runnable async?

lost matrix
sacred mountain
trail lintel
#

aye guys, im marking an entity for removal with Entity.remove(), but afterwards it leaves a ghost of the entity that stands in place and whos collision box still affects the player

lost matrix
trail lintel
#

disconnecting and reconnecting removes it, is this a known thing?

lost matrix
sacred mountain
#

do you mean putting the BukkitUtils.methodHere() inside the map?

#

but wont htat be equivalent to putting an actual value in the map

twilit roost
#

How to get direction that player moved in?

sacred mountain
#

when

#

player moved in? contexrt

sacred mountain
#

still don't understand

#

i'd appreciate some kind of example if you can

lost matrix
# sacred mountain uh?
  private final Map<String, Supplier<String>> placeholderMap = new HashMap<>() {{
    this.put(SERVER + "version", () -> BukkitUtils.getServerVersion());
    this.put(SERVER + "version_tab", () -> BukkitUtils.getVersion());
    this.put(SERVER + "name", () -> BukkitUtils.getServerName());
    ...
  }};

  public String onPlaceholderRequest(Player player, String placeholder) {
    if(player == null) {
      return null;
    }
    return placeholderMap.getOrDefault(placeholder, () -> null).get();
  }
sacred mountain
#

oh i see

#

so not putting the actual method, putting the value of the method at the time

#

of getting the value

lost matrix
#

Or to be more clear on what is happening:

  public String onPlaceholderRequest(Player player, String placeholder) {
    if(player == null) {
      return null;
    }
    Supplier<String> supplier = placeholderMap.getOrDefault(placeholder, () -> null);
    return supplier.get();
  }
sacred mountain
#

should i put it in the main class¿

#

the map i mean

lost matrix
lost matrix
sacred mountain
#

in the same class then as a private method

#

private map

#

not method

lost matrix
#

Yeah the map should be invisible to anyone else unless you want to let others register placeholders as well.
So putt it in the class that also contains the method.

halcyon mica
#

Is there an easy way to get the direction a player is looking at, and get the oposite of it?

#

Only yaw

sacred mountain
#

couldnt i use a method reference

#

instead of hte lambda

lost matrix
sacred mountain
#

or no

lost matrix
halcyon mica
#

-45 is not the oposite of 45

sacred mountain
#

no you're multiplying the vector by -1

#

its like

lost matrix
# sacred mountain or no
  private final MessageService messageService = new MessageService();
  
  private final Map<String, Supplier<String>> placeholderMap = new HashMap<>() {{
    this.put(SERVER + "version", () -> BukkitUtils.getServerVersion());
    this.put(SERVER + "version_tab", () -> BukkitUtils.getVersion());
    this.put(SERVER + "name", () -> BukkitUtils.getServerName());
    this.put("coolname", this::getCoolName);
    this.put("msg", msgService::getMessage);
    ...
  }};

  public String onPlaceholderRequest(Player player, String placeholder) {
    if(player == null) {
      return null;
    }
    Supplier<String> supplier = placeholderMap.getOrDefault(placeholder, () -> null);
    return supplier.get();
  }

  private String getCoolName() {
    return "Bob";
  }

There you go. One local method reference and one from another class instance.

sacred mountain
#

scalars

lost matrix
sacred mountain
#

i love the alt key 😍

lost matrix
halcyon mica
#

The plan is faily simple

#
        Vector invertedView = player.getEyeLocation().getDirection().multiply(-1);
        float yaw = (float)Math.atan2(invertedView.getX(), invertedView.getZ());
        if(data.dirLocked()) {
            // Snap to a cardinal direction
        } else {
            // Set rotation to face the player
        }```
halcyon mica
#

Snapping is the issue though, idk if I can use the minecraft direction implementation which I know for a fact can go off of an angle

sacred mountain
#

snapping?

green prism
#

How to create a paginated help menu like /help 1/2/3...? With 10 obj for each page?

sacred mountain
#

dynamic locations should fix yaw and pitch stuff

trail lintel
#

anybody got any idea why when I mark an entity with .remove(), it glitches client side and creates a frozen copy of the entity? reconnecting fixes it

sacred mountain
#

remove it with a packet ? idk much about packets tho

#

you could send it to the player after

#

removing it serverside

trail lintel
#

hmm, it seems weird that is even necessary when there is that remove function o.o

#

figure it would handle sending those packets

sacred mountain
#

yeah as i said im not sure, ill check gimme a sec

ocean lion
#

Is there any 'right way' when it comes to making GUIs. I feel like I always make it overcomplicated and really messy.

spice remnant
#

how to use 1.19 nms?

java.lang.NoSuchMethodException: net.minecraft.network.chat.ChatMessageType

sacred mountain
#

essentialsx uses the default e.remove()

#

and that works fine, what does your code look like

lost matrix
trail lintel
#

hmm so they do, ill post a snippet here RQ

sacred mountain
#

then again essentials is a big project so they might have some handler elsewhere that manages that

lost matrix
trail lintel
#
@EventHandler
public static void BucketEntityEvent(PlayerBucketEntityEvent event) {
  ItemStack original = event.getOriginalBucket();
  if(ItemManager.isBetterBucket(original.getItemMeta())) {
    if(ItemManager.interactableEntities.contains(event.getEntity().getType())) {
      original.setItemMeta(ItemManager.setContentType(original.getItemMeta(), ContentType.valueOf(event.getEntity().getType().name())));
      ItemManager.updateItemStack(original);
      event.getEntity().remove();
      // TODO: Should not just set main hand
      event.getPlayer().getInventory().setItemInMainHand(original);
    }
  event.setCancelled(true);
  }
}
#

cleaned it up a bit for ya

#

you can see I am cancelling the event, and removing the relevant entity

#

but the remove leaves a "ghost" client side, reconnecting fixes it though

lost matrix
trail lintel
#

ohhhh interesting idea 😮

#

not quite sure how to do that atm, will do some googling 😄

sacred mountain
#

bukkit runnable

chrome beacon
#

?scheduling

undone axleBOT
sacred mountain
#

runTaskLater

trail lintel
#

ayee thanks you guys, gonna try this will update with results

lost matrix
spice remnant
#

what if im using grade?

!spigotmain: Could not find org.spigotmcspigot1.19-R0.1-SNAPSHOT.
Required by:
project :spigot

chrome beacon
#

?bt You still need to run BuildTools

undone axleBOT
chrome beacon
#

Also you won't be able to remap

#

So either use Paper userdev or use unmapped NMS

lost matrix
sacred mountain
#

yo 7sm how would i put this in the map?

#

should i just keep that in the placeholderrequest

#

try the first one and if thats null try this else return params

lost matrix
ornate patio
#

does anyone know the range of horse speed, jump strength, and max health possible

#

like the natural range when spawning in

lost matrix
#

Horse's movement speed ranges from 0.1125–0.3375 in internal units, with an average of 0.225.

trail lintel
#

@sacred mountain @lost matrix it worked! delaying by 1 tick made the ghosting effect go away, you guys rock

#

that was the biggest bug preventing me from finishing up this plugin for our server =] thanks a bunch

ornate patio
#

to the point where you can sprint faster than it

sacred mountain
ornate patio
#

i also saw jump strength is 0.4-1.0, but at 1.0 the horse can jump 5.25 blocks and I also have never seen that before

#

welp i was just checking then

trail lintel
#

ok one final question 😉

sacred mountain
#

okay

trail lintel
#

is there a way to get the center of a block from the Location object? I want to spawn an entity in the center of a block rather than right on the corner

#

I could just add .5 to each, but figure there might be a function already

ornate patio
#

pretty sure you just have to do Location#getBlockX() + 0.5

trail lintel
#

block.getLocation().add(.5, .5, .5) 😉

ornate patio
#

ye that works

humble tulip
#

Mqke a func for it

sacred mountain
#

i dont like people who dont put a 0 before the decimal point

#

playerfishevent?

#

or no

humble tulip
ornate patio
sacred mountain
#

i was right

#

lmao i guessed

trail lintel
sacred mountain
#

() -> null is just getting the value, else return null right?

#

placeholderMap.getOrDefault(params, () -> null).get()

humble tulip
#

Again depending

#

If the block is air add 0 if it's solid add 1

tardy delta
#

why getOrDefault(key, null), thats the default implementation for get(key)

trail lintel
#

story of my time learning to dev for spigot haha, always another very specific scenario you have to account for if you overriding normal game behavior through event cancels

#

having to cancel all the regular bucket interact events because they replace the item meta, so doing all this bucket logic in the interact events

crude loom
#

Hi, I'm new to packets and I'm trying to use the entity move packet
If I understood correctly, using ProtoclLib it should be the PacketType.Play.Client.POSITION
How do I get the information about it though? like what variables can I get out of it (I'm asking where can I find this on google)

sacred mountain
#

i didnt write htat

#

there's got to be a better way of doing this

tardy delta
#

make the return value of get a variable lol

#

and do toString

sacred mountain
#

ok

halcyon mica
#

Can texts not escape UTF characters?

#

I am trying to set ▮ into a motd

#

And it just corrupts it

#

I can set it through code though

#

Also, different question

#

How do I rotate a armorstand, as in the entity itself?

#

Just setting y rot and x rot does nothing

sacred mountain
#

you need to telelport it to the same location, changed direction

#

i think location has the direction builtin so you just need to do armorStand.teleport(updatedLocationWithDirection)

halcyon mica
#

I have set the rotation before spawning the entity though

pale egret
#

I need help, when I did sudo apt install openjdk-14-jre-headless I got this error: 'openjdk-14-jre-headless' has no installation candidate

sacred mountain
#

Math.toRadians(yourDegreesHere)

#

EulerAngle(Math.toRadians(yourDegreesHere) , yDegrees , zDegrees)

humble tulip
#

?protocol

sacred mountain
#

bukkit has that builtin

#

i used it for particles

pale egret
sacred mountain
halcyon mica
#

Nope, that is still not it

sacred mountain
#

did you use

sacred mountain
#

armorStand.setHeadPose(new EulerAngle(Math.toRadians(blah), y, z))

halcyon mica
#

No, I am trying to rotate the entire entity

#

Not just the head

sacred mountain
#

setRotation?

humble tulip
#

Well u need to use yaw or pitch

sacred mountain
humble tulip
#

Not for thebhead

#

For the armorstand itself

halcyon mica
#

A nms armorstand has no setrotation function

#

just a set yrot and setxrot

#

Which I am using

sacred mountain
#

it inhertis the entity class tho

#

its also in the javadoc

#

oh nms

#

the bukkit api has stuff tho

halcyon mica
#

I am using a nms entity to fake packets

#

Can't really do that with bukkit entities unless I cast like 3 times in the process

sacred mountain
#

why woukd yioyu need to cast 3 times

quartz basalt
#

i am very confused... if (land.getOwnerUID() != p.getUniqueId()) { Bukkit.broadcastMessage("owner " + land.getOwnerUID() + " player " + p.getUniqueId()); p.sendMessage(ChatColor.translateAlternateColorCodes('&', "&7You do not own this claim")); i need to make a thing that checks if land.getowner and p.getunique are different but this ALWAYS triggers which makes no sense because when i broadcast the 2 they are the exact same so why is this happening

quiet ice
#

Use .equals

#

!= uses instance comparision

halcyon mica
quiet ice
#

Or however you call it

sacred mountain
#

Objects.equals(a,b)

halcyon mica
#

So I would need to go between a craftbukkit and nms entity constantly

quartz basalt
#

ah ight ty

green prism
#

Guys, please help.
How can I close these two PreparedStatment and ResultSet?

    public HashMap<Integer, String> getValues() {

        try {
            PreparedStatement ps = plugin.getMySQL().getConnection().prepareStatement("SELECT * FROM agencies");
            ResultSet rs = ps.executeQuery();
            HashMap<Integer, String> values = new HashMap<>();
            while (rs.next()) {
                values.put(rs.getInt("ID"), rs.getString("AgencyName"));
            }
            return values;
        } catch (SQLException e) {
            if(e == e.getNextException())
                return null;
            e.printStackTrace();
        }
        return null;
    }```
quiet ice
#

!= is only appropriate when comparing primitives and enums, but not much more unless you know what you are doing

sacred mountain
#

or instances

ocean lion
#
 Player whoToTarget = player.getServer().getPlayerExact(ChatColor.stripColor(event.getCurrentItem().getItemMeta().getDisplayName()));

How would I access whoToTarget from else if statement under

quiet ice
#

This also applies to wrapper classes, Integer.valueOf(5926) == Integer.valueOf(5926) will return false for example

green prism
sacred mountain
#

i forgot the word for it

#

theres like instantiation, assignment and seomthing

#

declaration?

#

or was the first one initialization

eternal oxide
green prism
eternal oxide
#

PreparedStatement is AutoCloseable

green prism
#

ah

eternal oxide
#

no, that will close it when its finished

quiet ice
sacred mountain
#

yez

green prism
#

I didn’t know, thank you so much again Elgar! You’re giving me a great helping hand in learning mysql & java!

eternal oxide
#

in a try with resources once you exit the scope of the try it will auto close anything in the try (...)

green prism
#

I understand, thanks thanks thanks

rare flicker
#

where should i report spigot bugs?

green prism
#

Forum I think

eternal oxide
#

?jira

undone axleBOT
rare flicker
#

thx

#

has to do with the way an item gets saved to a YamlConfiguration

#

theres a name missmatch for enchantments

#

still works just doesnt make sense

green prism
# eternal oxide ?jira

Hey elgar, do you know how to create a paginated menu? Like /help 1, 2, 3... with some dynamic values?

sacred mountain
#

when i print a normal string with \u2713 in it, will it automatically convert it to a symbol in the console?

rare flicker
#

(efficiency is stored as SILK_TOUCH for eg)

quiet ice
#

"Working as intended"

eternal oxide
green prism
#

Uhh! Thanks!

sacred mountain
#

will this work

#

or can i literally just do this

quiet ice
#

that is a very strange way of doing it

#

i.e. I have never seen that syntax

eternal oxide
#

Either will work, but correctly private final String claimedPlot = "\u2B1B";

sacred mountain
#

oh right

#

so without the brackets

#

why is it an emoji bruh

#

that looks so ugly

quiet ice
#

what do you mean?

#

Blame your character set if you are complaining about what I think you are complaining

sacred mountain
#

how do i even change that

quiet ice
#

Adopt vim I guess

quartz basalt
quiet ice
#

I know that eclipse has a way of chaning the fonts that are used but idk how IJ works so yeah - you'd need to use vim

ocean lion
quartz basalt
#

oh wait im dumb mb just reliased

#

is it possible to get all the specific items from a specific creative category like all the redstone items for example

quiet ice
#

I think that was always a bit of magic

neon nymph
#

In an attempt to store a key-value pair in an ordered list, instead of using LinkedHashMap, I created my own simple Pair<K, V> class and did this instead ArrayList<Pair<K, V>>. In this approach, I could easily get the last entry anytime I want using the arraylist indices instead of having to iterate over every entry in LinkedHashMap, costing me like O(n). Is this approach feasible?

quiet ice
#

Feasible, yes - does it makes sense? I do not know

neon nymph
#

Well originally I wanted to have an ordered list of two variables, and thought of pairing them together instead to simplify things

silver pulsar
#

Hi.
I'm trying to store a list of locations and I've used a File to store the data between server restarts. but im having some trouble retrieving and storing the list to a variable. I know that im retrieving the List correctly but when im trying to make it to the variable it breaks.

What ive tried:
public static List<org.bukkit.Location> DrillLocations = new ArrayList<>(); DrillLocations.addAll(FileHandeler.getFile().getList("Cords"));
And:
public static List<org.bukkit.Location> DrillLocations = FileHandeler.getFile().getList("Cords");

latent heron
#

Anyone know a plugin or something so like when a player presses like E on their keyboard it executes a command?

sacred mountain
latent heron
#

thanks

quiet ice
sacred mountain
#

big o notation"?'/

neon nymph
#

Well, isn't that a good thing? I'd go for constant time any day compared to potentially longer time

#

Since my list is gonna be big, like 100+

quiet ice
#

.get is now more expecsive

#

At least the map-like get

#

The list-like get is now O(1)

neon nymph
#

It's always been cuz of the indices

#

That's why I used arraylist instead of LinkedHashMap, the latter didn't have .getLastEntry() or something similar

#

I need the last entry most of the time lol