#help-development

1 messages · Page 1521 of 1

lofty junco
#

this is my main code the code above was for testing

#

i want to sort the item by its name example item1 name = online second item name offline

wraith rapids
#

sort the friends, then populate the inventory from that sorted list

vast sapphire
#

idk what to do, i tried putting && so if getHitEntity = fireball then it shouldn't create an explosion

#

oh i messed u[

#

changed the if statement to if (event.getHitEntity() != fireball) {

#

i mean that shoulkd work

lofty junco
#

i have something like this but im lost its 12 pm my brain i dont know how to do this neeed help xD

#

public class SortComparatorManager implements Comparator<ItemStack>{
@Override
public int compare(ItemStack o1, ItemStack o2) {
return o2.isSimilar(o1);
}
}

#

i know it return an boolean

wraith rapids
#

you don't want to check if the item is similar

quaint mantle
#

Code blocks smh

wraith rapids
#

you want to check if the item is greater or lesser

#

you need to tell it which one should be placed first in the list

#

not whether they're equal or not

#

again, sort the friends list, Strings are naturally comparable

#

and then populate the inventory based on that sorted list

#

no point in sorting itemstacks

quaint mantle
#

p.getInventory().addItem(new ItemStack[] { this.what do i put here in order to get the item selected to the inventory });

#

or should i do:

#

p.getInventory().addItem(ItemLocalCreated);

#

idk if that would work

lofty junco
wraith rapids
#

sort the fucking string list

lofty junco
#

it was an example

#

chill damn

wraith rapids
#

it's literally been an hour

#

of me telling you to sort the string list

lofty junco
#

Something like that: List<String> definedOrder = Arrays.asList("§8[§aOnline§8]", "§8[§cOffline§8]");

wraith rapids
#

are you trying to sort them based on who is online and who is not

lofty junco
#

yea

wraith rapids
#

Comparator.comparingInt((player) -> player.isOnline() ? 0 : 1)

vital ridge
#

Could someone help me to create smthing? Basically im trynna create a system where if you give player an item with my command, it will add as much of the item as possible and then drop the rest on the ground and no, this is not achievable with firstEmpty method, Im just wondering if anyone has done it before cuz im strugglin

wraith rapids
#

addItem(s)

#

the method returns a Map of the items that didn't fit

#

drop those items on the floor

lofty junco
#

for (int i = currentPage * 45; i < currentPage * 45 + maxItemsInInv; i++) {
friendInfo = SpigotServices.getService().getPlayerService().getPlayersInfo(friends.get(i));
inventory.setItem(count++, buildFriend(friendInfo));
}
player.openInventory(inventory);

wraith rapids
#

Comparator.comparing((item) -> item.methodToGetItemStackName())

lofty junco
#

okay im trying it thx and sry im not so long in the java scene im trying my best

vital ridge
wraith rapids
#

myes

#

The returned HashMap contains what it couldn't store, where the key is the index of the parameter, and the value is the ItemStack at that index of the varargs parameter. If all items are stored, it will return an empty HashMap.

lofty junco
#

@wraith rapids ive done this ItemStack itemStack = buildFriend(friendInfo);
Comparator.comparing((item) -> itemStack.getItemMeta().getDisplayName());

wraith rapids
#

Collections.sort(list, comparator)

vital ridge
# wraith rapids myes

Im problaly doing it wrong but this code only drops 1 item on the ground even if there should be like 300 leftovers

for (int i = 0; i < leftOvers.keySet().size(); i++) {
                            
                            target.getWorld().dropItem(target.getLocation(), leftOvers.get(i));
                            
                            }
reef wind
#

all those tabs hurt my soul

vital ridge
#

returns 0*

wraith rapids
#

leftOvers.values().forEach((stack) -> drop stack)

#

if the map is empty then all of the items were fit in the inventory

vital ridge
#

Im giving myself 5k items

#

at it still just drops 1 egg

wraith rapids
#

it might not like stack sizes of 5k

vital ridge
#

stack sizes?

#

Im not fking with stack sizes tho

#

Isnt there like any other methods?

wraith rapids
#

what are you doing then

uncut oxide
#

So I'm trying to upgrade an abandonware plugin that I've been using on my server, I'm by no means a spigot dev. I'm getting an exception thrown here:

Object stack = itemConstructor.newInstance(craftingResult);

because itemConstructor is null. The itemConstructor is created from the following: https://pastebin.com/WbjfG5tv
some of this is the dev's original code, and some in mine. Kinda been stumbling through, any help would be greatly appreciated.

vital ridge
#

Im trying to just create a system so if i give myself too many items it will fill my inv up and then drop the rest

#

thats just it

#

like essentials does with the kits basically

wraith rapids
#

show code

vital ridge
#
for (int i = 0; i < (CountCheck.ifCountIsZeroOrLess(amount) ? 1 : amount); i++) {
                                
                                leftOvers = target.getInventory().addItem(normal);

                            }
                            
                            System.out.println(leftOvers.values());
                            
                            leftOvers.values().forEach((stack) -> target.getWorld().dropItem(target.getLocation(), normal));
#

currently doing it like that

uncut oxide
#

if anyone gets a chance to glance at my code, please shoot me a ping, I don't look at discord much

wraith rapids
#

add the items in bulk

#

adding them one by one is inefficient

#

your drop loop is after the additem loop

#

put the leftovers.values loop inside the for i loop

vital ridge
#

this fixed it

#

tysm

#

rly

lofty junco
#

@wraith rapids

#

for (int i = currentPage * 45; i < currentPage * 45 + maxItemsInInv; i++) {
friendInfo = SpigotServices.getService().getPlayerService().getPlayersInfo(friends.get(i));
ItemStack itemStack1 = buildFriend(friendInfo);
list.add(itemStack1);
list.sort(Comparator.comparing((item) -> itemStack.getItemMeta().getDisplayName().equalsIgnoreCase("§8[§aOnline§8]")));
inventory.setItem(count++, list.get(i));
}

#

whats wrong there

#

private ItemStack buildFriend(PlayerInfo playerInfo) throws ParseException {
FriendsInfo friendsInfo = SpigotServices.getService().getFriendsService().getPlayerFriendsInfo(playerInfo.uuid).getValue();
return friendsInfo.isOnline ? ItemManager.getHead(playerInfo ,"§b" + playerInfo.getPlayerName() + " §8[§aOnline§8]",
"§7Server ➜ §b" + playerInfo.getCurrentServer(), "§8➜ §bRechtsklick§7, um weitere §bOptionen §7vorzunehmen")
: ItemManager.getCustomTextureHeadForPlayer(FriendsSystem.instance.customTextureManager.customTexturesMap.get("offline"),
"§b" + playerInfo.getPlayerName() +" §8[§cOffline§8]","(zul. online vor " +
getLastOnlineDate(friendsInfo) + ")", "§8➜ §bRechtsklick§7, um weitere §bOptionen §7vorzunehmen");
}

quaint mantle
#

Is there a way to verify in a shapeless recipe if one of the items has a certain value in a persistentdatacontainer? (custom recipes with custom items)

eternal oxide
#

Not sure if this was resolved. He's not using GroupManager, thats Multiverse Inventories

lofty junco
quaint mantle
#

Error: If you wish to use IP forwarding, please enable it in your BungeeCord config as well!
I have true

#

Version spigot 1.17

shadow gazelle
#

How do you set the path to your Java executable with gradle? My JAVA_HOME is set to Java 8 and I don't want to change it.

haughty reef
shadow gazelle
#

Already tired that and it changes nothing

haughty reef
#

Send gradle logs?

shadow gazelle
#

Ah, found the setting in IntelliJ

haughty reef
#

Ah, IntelliJ uses different settings that what you define in Gradle, I hate it

shadow gazelle
#

Oh

haughty reef
#

IntelliJ has it's own version of java it uses for gradle, so keep that in mind if you ever want to update to a new JDK. There's like 3 different settings: https://stackoverflow.com/a/64220088/4957612 (a different answer, but talks about intellij)

haughty reef
#

Hey, so I'm having trouble removing recipes for "suspicious stew". When I use the Recipe Iterator, none of the Recipe's getResult() matches suspicious stew. I printed out all Materials and I can only see rabbit or mushroom stew. What am I missing? Also, if I just do Server.clearRecipes(), I am no longer able to craft it. Is it technically a part of another recipe?

valid totem
#

help

haughty reef
#

Only if you give me more info than "help"

valid totem
#

sorry it was in wrong channel

#
java.lang.NullPointerException: Cannot invoke "net.minecraft.server.players.GameProfileBanEntry.hasExpired()" because the return value of "net.minecraft.server.players.GameProfileBanList.get(Object)" is null
#

i get this error

#

on when temp ban expires

haughty reef
#

Is this happening in code you're writing or just in your server?

valid totem
#

the server

haughty reef
valid totem
#

this is on client

haughty reef
# valid totem the server

Okay, so you didn't write the plugin? In that case, #help-server is the correct place for your question.

My advice is to restart the server and see if that fixes it.

If not, see if there's the name of a plugin you use anywhere near the "NullPointerException" error message. Try removing that plugin and see if your server works again.

The folks in the help-server channel should be able to help if that doesn't work

valid totem
#

there isnt

haughty reef
#

Can you send the line above the NullPointerException?

valid totem
#
Failed to handle packet for /127.0.0.1:36454
#
[16:57:35] [Server thread/WARN]: Failed to handle packet for /127.0.0.1:36454
haughty reef
#

How much more WARN or ERROR is there above that?

valid totem
#
[16:57:32] [Server thread/INFO]: HAHALOSAH left the game
[16:57:35] [User Authenticator #146/INFO]: UUID of player HAHALOSAH is 1da9c91a-6895-4b54-bcdc-a9e9239c9cb7
[16:57:35] [Server thread/WARN]: Failed to handle packet for /127.0.0.1:36454
java.lang.NullPointerException: Cannot invoke "net.minecraft.server.players.GameProfileBanEntry.hasExpired()" because the return value of "net.minecraft.server.players.GameProfileBanList.get(Object)" is null
haughty reef
#

Okay, that's bizarre, it does seem to be minecraft code that's failing... Try downloading and installing the latest version of Spigot (cough cough paper cough cough) and restart

valid totem
#

Paper doesnt like NMS

#

so paper isnt an option

#

and i JUST built spigot

#

im restarting server

quaint mantle
haughty reef
valid totem
#

i just rebuilt spigot

quaint mantle
#

@valid totem what did u type before u edit?

valid totem
#

sorry i meant to say use new ItemStack(Material.DIRT, 64)

#

as an example

quaint mantle
#

that would just give dirt

valid totem
#

what do you need it to give

quaint mantle
#

i dont want to creat a new one every time i add a new item at the gui shop

haughty reef
valid totem
#

oh that

haughty reef
#

That may not be what you want, but that's how the syntax works

quaint mantle
#

ok

haughty reef
quaint mantle
#

thanks i will just use that

valid totem
#

ok i just restarted server still getting error

haughty reef
#

Damn, are you able to try deleting the world folder? If it has precious data, rename it to "old_world" then try a restart

valid totem
#

sure

#

should i do mv world world.old

haughty reef
#

Same diff

valid totem
#

ok im restarting

dusky spade
#

how can I register a tab complete for commands I made with the plugin mycommands?

valid totem
#

oof still not working

quaint mantle
haughty reef
valid totem
#

no

#

maybe it is essentailsx

#

it probably doesnt fully support 1.17

haughty reef
valid totem
#

how

#

/plugins?

haughty reef
#

Yeppers

#

Also, you can mv world.old world now if you want

valid totem
#

kk

haughty reef
haughty reef
valid totem
#

only 2

steep nova
# valid totem

If you're temp banning through essentials then its an essentials problem

valid totem
#

im temp banning through my plugin

steep nova
#

oh

#

well that changes everything

valid totem
#

Bukkit.getBanList(Type.NAME).addBan(banning.getName(), banReason, unbanTime.getTime(), "");
my line of code

#

it uses the bukkit ban system

#

its not my plugin

steep nova
#

ye but somewhere in your code you're going out of bounds on an array

valid totem
#

hmm

#

ima try removing essentials

#

still not wokring

#

ok

#

its not my plugin

#

its NMS

#
java.lang.NullPointerException: Cannot invoke "net.minecraft.server.players.GameProfileBanEntry.hasExpired()" because the return value of "net.minecraft.server.players.GameProfileBanList.get(Object)" is null
    at net.minecraft.server.players.PlayerList.attemptLogin(PlayerList.java:577) ~[spigot-1.17.jar:3151-Spigot-101ebb6-68d4031]
    at net.minecraft.server.network.LoginListener.c(LoginListener.java:156) ~[spigot-1.17.jar:3151-Spigot-101ebb6-68d4031]
    at net.minecraft.server.network.LoginListener.tick(LoginListener.java:74) ~[spigot-1.17.jar:3151-Spigot-101ebb6-68d4031]
    at net.minecraft.network.NetworkManager.a(NetworkManager.java:246) ~[spigot-1.17.jar:3151-Spigot-101ebb6-68d4031]
    at net.minecraft.server.network.ServerConnection.c(ServerConnection.java:172) ~[spigot-1.17.jar:3151-Spigot-101ebb6-68d4031]
    at net.minecraft.server.MinecraftServer.b(MinecraftServer.java:1319) ~[spigot-1.17.jar:3151-Spigot-101ebb6-68d4031]
    at net.minecraft.server.dedicated.DedicatedServer.b(DedicatedServer.java:436) ~[spigot-1.17.jar:3151-Spigot-101ebb6-68d4031]
    at net.minecraft.server.MinecraftServer.a(MinecraftServer.java:1200) ~[spigot-1.17.jar:3151-Spigot-101ebb6-68d4031]
    at net.minecraft.server.MinecraftServer.x(MinecraftServer.java:1027) ~[spigot-1.17.jar:3151-Spigot-101ebb6-68d4031]
    at net.minecraft.server.MinecraftServer.lambda$0(MinecraftServer.java:307) ~[spigot-1.17.jar:3151-Spigot-101ebb6-68d4031]
    at java.lang.Thread.run(Thread.java:831) [?:?]
#

the stack trace shows NMS code

steep nova
#

ight

haughty reef
valid totem
#

now what do i

#

NMS is failing

haughty reef
valid totem
#

and i cant do anything about it

dusky spade
valid totem
dusky spade
haughty reef
#

Well, this is just a troubleshooting step

haughty reef
valid totem
#

there isnt a vaniila temp ban command

haughty reef
#

So are you trying to make your own ban command?

steep nova
valid totem
#

ok i just remove my plugin

#

and i added essentaisl back

#

same error

#

same stack trace

#

its just NMS code

haughty reef
#

That's so bizarre. Have you restarted your client? 😂

#

Are you restarting after removing plugins?

#

Sorry to ask obvious questions, just don't know how tech savvy you are

haughty reef
valid totem
#

Tech

#

I tried everything already

#

I tried removing plugins already

#

Its still the same error

steep nova
#

maybe try in a completely new folder w/ a fresh server .jar

valid totem
#

I dont think i had this error with 1.16

azure dune
#

Has anyone in here managed to increase the max build height of a 1.17 Spigot server?

valid totem
#

Yeah

#

Data packs

azure dune
#

Link?

#

I don't want the new generation, I just want to change world height.

valid totem
#

I dont have a link

#

Lmao

azure dune
#

bruh

valid totem
#

Go to slicedlime’s repository for vanilla worldgeb

haughty reef
#

1st link on google for "datapacks minecraft": https://minecraft.fandom.com/wiki/Data_Pack

Minecraft Wiki

The data pack system provides a way for players to further customize their Minecraft experience. Data packs can be used to override or add new advancements, dimensions, functions, loot tables, predicates, recipes, structures, tags, world generation settings, and biomes without any code modification.

valid totem
#

Then modify the height attribute

#

Just tried in 1.16 server jar, no problem

#

Its just 1.17 nms

azure dune
#

I don't get it lol

valid totem
#

When i get back home i will make a pack and send a google drive link

eternal oxide
#

Any plugin that uses NMS and is written for 1.16 will not work on 1.17

valid totem
#

Yep

#

I think

#

Since nms versions change

#

Also 1.17 nms is completely different

#

Instead of net.minecraft.server.v1_16_R3.NBTTagCompound its net.minecraft.nbt.NBTTagCompound in 1.17

#

Also spigot failed to deobfiscate most of the nms

#

I had to decompile manually

eternal oxide
#

spigot not longer has mappings for nms

valid totem
#

Ye

#

But idk why

eternal oxide
#

eventually it will implement the Mojang mappings

haughty reef
#

Decompiling sucks

valid totem
#

Why doesnt spigot have mappings for 1.17

#

How did they get the 1.16 mappings

eternal oxide
#

Because they are being replaced

quaint mantle
#

google doesnt help either idk what to google

haughty reef
#

Material.POTION is a thing

#

Probably some ItemMeta that goes with it

quaint mantle
#

ok

haughty reef
azure dune
#

nvm fixed it, got a datapack 👍

quaint mantle
#

how do we check if the player's offhand item is nothing/null

proven sierra
#

will never be null

#

just check if type is air

#

(at least, will never be null in paper. not too sure about spigot)

quaint mantle
#

if(!(offHand == null && offHand.getData().getItemType().equals(Material.AIR))) {

#

doesn't work

proven sierra
#

well obviously it doesn't work

#

that makes no sense

#

learn java

quaint mantle
#

You should go and learn it again if you can't understand a single line of code

#

f(e.getPlayer().getInventory().getItemInOffHand() != null && !e.getPlayer().getInventory().getItemInOffHand().getData().getItemType().equals(Material.AIR))

#

if you tell me that that makes no sense you need to go get a life

dusty sphinx
#

I'm trying to patch an issue with a plugin I've been using for a while that uses SpigotConfig, for some reason. I'm not really a Java developer, but I (mostly) know my way around.
How can I get the spigot.yml YamlConfiguration? I've read the docs and I can't quite seem to figure out how to implement the nested class Server.Spigot.

eternal oxide
quaint mantle
#

they should both work buddy

#

funny guy

eternal oxide
#

No, the first one is logically incorrect

quaint mantle
#

and anyways it passes thru both

#

so whatever ur saying is shit

#

anyways

eternal oxide
#

OK, be rude and don;t learn

#

go read yrou first post again and see what you did wrong

quaint mantle
#

certainly won't learn from a beginner like u

#

go learn java before trying to give advice<

eternal oxide
#

Yep, complete beginner here.

quaint mantle
#

talking bout you :)

eternal oxide
#

Your first post is wrong. It actually says if hand IS null and its type air, the invert the logic to a negative.

#

if the first test passes as null the second would explode with an npe

quaint mantle
#

I put a ! in the beginning buddy

eternal oxide
#

that ! is outside the parenthesis

#

buddy

quaint mantle
#

yep, that's how java works -_-

eternal oxide
#

No its not

quaint mantle
#

what do you think that does ```
if(!(true))

#

if its false it will go thru

eternal oxide
#

The internal scope of your logic is tested together, so IS null and type is air

#

yes, but that is NOT what you wrote

quaint mantle
#

it IS

#

( -----------> !(offHand == null && offHand.getData().getItemType().equals(Material.AIR))) <------

eternal oxide
quaint mantle
#

exactly

eternal oxide
#

I'll let you look over that and see where you went wrong

quaint mantle
#

it passes thru both if statements anyways so they are equivalent buddy

wet breach
quaint mantle
#

but with another ! before the AIR check<

#

but that's exactly what my other if statement is

#

still went thru tho :/

eternal oxide
#

its not what your statements logic does

quaint mantle
#

oh

#

my

#

gkod

#

buddy

#

get out

eternal oxide
#

Learn some manners dick. Thats THREE people who have told you are wrong and you still insist you are correct

quaint mantle
#

nope

#

frostall was not saying you were right

eternal oxide
#

yes he was

quaint mantle
#

ur the only one on your side 🙂

#

and the second if i sent is right anyways

eternal oxide
#

and AvroVulcan before me

quaint mantle
#

oh he's shit too then

#

cuz my second if

eternal oxide
#

oh My its another Floofy

quaint mantle
#

still doesn't work

#

so you're basicvly

#

saying that that doesnt work

#

if(!(e.getPlayer().getInventory().getItemInOffHand() == null) && !e.getPlayer().getInventory().getItemInOffHand().getData().getItemType().equals(Material.AIR))
{

#

cuz you didn't talk much about that one didn't you when i sent it and said it didn't work

eternal oxide
#

are you simply tryign to test its not null and not air?

quaint mantle
#

yes.

wet breach
#

Anyways, lets move on and figure out the problem at hand 😉

quaint mantle
#

❤️

eternal oxide
#

then if (hand != null && !hand.getType().equals(Material.AIR))

quaint mantle
#

that's

#

literally my code

eternal oxide
#

will pass if its NOT null and its NOT air

quaint mantle
#

that i have

#

and told you already that it doesn't work

eternal oxide
#

no look again

quaint mantle
#

like

#

uhm

#

10 times

eternal oxide
#

you don;t use getData().getItemType()

quaint mantle
#

?

eternal oxide
#

its an ItemStack you simply use item.getType()

quaint mantle
#

oh

#

that's what my problem was all along

#

wow

#

alright

small vine
#

I'm using Intellij IDEA, and have added a filed called announcer.txt where i will put text messages. But the file doesn't automatically appear in the plugin folder. Is there something i need to do to get my plugin folder to appear?

hexed hatch
#

Where is announcer.txt?

eternal oxide
small vine
#

I didn't use the built in config method. I've set up a text reader manually.

eternal oxide
#

then manually create your folders and use saveResource

small vine
#

Right, that sounds easy and straight forward. I'll give it a try. I'm comfortable with C#, but java is something else man

#

That helped, thanks!

quaint mantle
#

trying to make a spigot plugin
but where is @EventHandler and stuff like that
am i missing an entire part of intellij
i have minecraft development plugin installed

#

already answered in #general

#

I was using this ant build script to copy the jar after the maven build to my test server, which worked fine until I needed to shade a dependency in, now it copies the jar before its shaded and idk how 2 fix it but I would like to use it again. https://paste.md-5.net/xihemebewu.xml
(using intellij, I added the script as an ant build file, and created a run target for it than ran after a maven build goal)

#

would like to either fix this, or find another solution to copy the output jar without moving the original from the target directory

sullen marlin
#

move the ant plugin below the shade plugin

#

though there are maven plugins that can copy a file (though I do see ant is the top answer on stackoverflow)

wet breach
quaint mantle
#

alright, thank you both! <3

#

no img perms

#

package me.darkercyan.myfirstplugin;

import org.bukkit.plugin.java.JavaPlugin;

public final class MyFirstPlugin extends JavaPlugin {

@Override
public void onEnable() {
    // Plugin startup logic
    System.out.println("My First Plugin has started!!! Hello!!!");

}

@EventHandler
public void onLeaveBed(){

}

}

#

verify to get upload perms

undone axleBOT
cloud berry
quaint mantle
#

its not tho

cloud berry
#

no u only import javaplugin

quaint mantle
#

show us where u import eventhandler

cloud berry
#

u need eventhandler

quaint mantle
#

look

#

again, you didnt import eventhandler

#

what link

#

do

#

i

#

need

#

to

#

import

cloud berry
#

bruh 🤣

sullen marlin
#

?maven

undone axleBOT
cloud berry
#

do u kno java liek at all

#

we r talkin bout ur import statement

quaint mantle
#

java yes, plugins 0%

cloud berry
#

which should b plural

sullen marlin
#

oh yeah, ignore me

cloud berry
#

then u should kno wat an import is 🤣

sullen marlin
#

you just dont have an import

quaint mantle
#

dont ignore this, i was using python for 6 months

#

so i kinda forgot

#

how to use java

cloud berry
#

bows down n begs for his life for ignorin lord n saviore md md_5 5

sullen marlin
#

also how come intellij isnt underlining errors

cloud berry
quaint mantle
cloud berry
#

import org.bukkit.event.EventHandler;
^ literally this 🤣 no link

quaint mantle
#

it has org. thats a "link"

hardy swan
#

Guys

quaint mantle
#

i mean package

#

but like that

#

yes

hardy swan
#

Implements Listener

hexed hatch
#

If you're using IntelliJ and you have your Maven imports set up correctly, you should be able to type @EventHandler and then press alt + enter to import it automatically

hardy swan
#

Bruh

cloud berry
hardy swan
rugged girder
#

Enables Auto imports. Confirm your dependencies. Never worry about it again.

quaint mantle
#

wtf, I didn't know intellij had auto import :0

rugged girder
#

Ye

hexed hatch
#

I literally have done nothing but auto import

#

I've never had to write out an import lol

hardy swan
#

use vscode

#

best

cloud berry
quaint mantle
#

eh, i like vscode, but not for java

hexed hatch
#

but close and open a couple times and you'll get it 100% of the time 75% of the time

cloud berry
#

fucky covers it yes 😄

compact haven
#

I've only written imports when working with kotlin files

#

sometimes they arent recognized by intellij so I need to write them out manually, whihc is a pain

#

but other than that, it's been fine

quaint mantle
#

thonk

#

how do you guys have issues like this

#

intellij would def error if it didn't recognize an import

small vine
#

as far as i can understand, when using the built-in configs for spigot, a folder and a config file should be created. I've put the following code in onEnable:
`// CONFIG STUFF
String an_si = "§c>";
FileConfiguration conf = this.getConfig();
// conf.options().header("Customize the messages as you wish!");
conf.addDefault("one", an_si + " §3Report other players with &r/report <player> <report>");
conf.addDefault("two", an_si + " &3Check your balance with &r/balance");
conf.addDefault("three", an_si + " &3Vote for DustyBawls with &r/vote");
conf.addDefault("four", an_si + " &3Don't forget to set your spawn point with &r/sethome");
conf.addDefault("five", an_si + " &3Claim your land with /kit claim");
conf.addDefault("six", an_si + " &3Signs can be placed on containers to secure them");

    // CONFIG - Save config
    conf.options().copyDefaults(true);
    conf.options().copyHeader(true);
    saveDefaultConfig();`
quaint mantle
#

What causes this duplication behavior in creative mode?
Basically I'm adding an enchant to an item when its clicked with a nether star.
All I'm doing this and it works fine in survival:

cursorItem.setAmount(cursorItem.getAmount() - 1);
currentItem.addEnchantment(crystalType.getEnchantment(), enchantmentLevel);
compact haven
#

Creative mode is fucky

sullen marlin
#

creative mode is client controlled

quaint mantle
#

ah, okay.

rugged girder
#

Have you cancelled the click event though

#

Md_5 can correct me obviously but I believe click events are still server side

quaint mantle
#

Yes, I tried with and without cancelling it

quaint mantle
#

is there any way to run the plugin in the IDEs? Like you can do with mods

#

for debugging purposes

young knoll
#

You can attach the debugger remotely

quaint mantle
#

make the code in it faster

quaint mantle
valid totem
#

after a tempban expires, i get a really weird error

#

and in console:

#
[21:30:05] [Server thread/WARN]: Failed to handle packet for /127.0.0.1:42794
java.lang.NullPointerException: Cannot invoke "net.minecraft.server.players.GameProfileBanEntry.hasExpired()" because the return value of "net.minecraft.server.players.GameProfileBanList.get(Object)" is null
    at net.minecraft.server.players.PlayerList.attemptLogin(PlayerList.java:577) ~[spigot-1.17.jar:3151-Spigot-101ebb6-68d4031]
    at net.minecraft.server.network.LoginListener.c(LoginListener.java:156) ~[spigot-1.17.jar:3151-Spigot-101ebb6-68d4031]
    at net.minecraft.server.network.LoginListener.tick(LoginListener.java:74) ~[spigot-1.17.jar:3151-Spigot-101ebb6-68d4031]
    at net.minecraft.network.NetworkManager.a(NetworkManager.java:246) ~[spigot-1.17.jar:3151-Spigot-101ebb6-68d4031]
    at net.minecraft.server.network.ServerConnection.c(ServerConnection.java:172) ~[spigot-1.17.jar:3151-Spigot-101ebb6-68d4031]
    at net.minecraft.server.MinecraftServer.b(MinecraftServer.java:1319) ~[spigot-1.17.jar:3151-Spigot-101ebb6-68d4031]
    at net.minecraft.server.dedicated.DedicatedServer.b(DedicatedServer.java:436) ~[spigot-1.17.jar:3151-Spigot-101ebb6-68d4031]
    at net.minecraft.server.MinecraftServer.a(MinecraftServer.java:1200) ~[spigot-1.17.jar:3151-Spigot-101ebb6-68d4031]
    at net.minecraft.server.MinecraftServer.x(MinecraftServer.java:1027) ~[spigot-1.17.jar:3151-Spigot-101ebb6-68d4031]
    at net.minecraft.server.MinecraftServer.lambda$0(MinecraftServer.java:307) ~[spigot-1.17.jar:3151-Spigot-101ebb6-68d4031]
    at java.lang.Thread.run(Thread.java:831) [?:?]
[21:30:05] [Server thread/INFO]: com.mojang.authlib.GameProfile@19446407[id=1da9c91a-6895-4b54-bcdc-a9e9239c9cb7,name=HAHALOSAH,properties={textures=[com.mojang.authlib.properties.Property@5e025d75]},legacy=false] (/127.0.0.1:42794) lost connection: Internal server error
#

this happens only on 1.17, with any tempban plugin

quaint mantle
quaint mantle
valid totem
#

nvm

#

but i still need a fix

small vine
#

Quick question: How do i fetch the messages as an array? The plan here is to broadcast messages to the main chat for everyone to see, starting on one, after 30 minutes send two, 30 more minutes etc etc.

#

Might be important to know that I'm using the builtin configuration for bukkit/spigot

sage swift
#

getConfigurationSection

small vine
sage swift
#

ah yes wrap that in an array

#

(what)

small vine
#

??

#

whats your issue

#

lol

#

what i meant is I'll put getConfigurationSection inside an array container. Are you in #help-development to help or shit on others?

sage swift
#

the latter

#

you can use ConfigurationSection#getKeys to get the names of each key

#

for example if i have yml section: key1: 'something' key2: 'somethingelse' key3: 'anotherthing' calling (config).getConfigurationSection("section").getKeys(false) would get me a Set with key1, key2, and key3

small vine
#

what's that false doing at the end? whats that for?

sage swift
#

deep, meaning if i have nested sections it would get all the keys

small vine
#

cool

sage swift
#
section1:
  section2:
    section3: {}``` section1.getKeys(true) would return section2 and section3
small vine
#

ow

clear harness
#

Does anyone know of a good wrapper class for NMS that isn't like super outdated? I've been looking for one but all the ones I have found haven't been updated since 1.13

sage swift
#

@waxen plinth's RedLib has NMSHelper which is pretty good 🙊

waxen plinth
#

It's hardly a wrapper

#

More of a reflection helper with a few NMS specific things

#

Won't handle the version differences except package naming at all

#

Probably not what you're looking for

maiden thicket
#

do u even really need an nms wrapper

sage swift
#

m&m wrapper

#

just use the skittle api

jagged monolith
#

With Scoreboard teams, is it possible to make the team#setColor to access hex colours?

#

Well... that's annoying

sage swift
#

but doesnt it not even take a color?

jagged monolith
#

It takes a normal ChatColor value. Like &c etc...

#

Not hex.

sage swift
#

i dont remember there being 16 glow colors

jagged monolith
small vine
#

I've been trying for 2 hours now and might need some assistance with this one. I'm trying to fetch all strings under messages. These will be used to schedule announcements every 30 minutes. I've been told I have to use config.getConfigurationSection("messages").getKeys(false). Whats the proper method to get this done?

#

ow gecko! you're awake

quiet ice
#

yes, I use the getKeys method, then using those keys to fetch the data

sage swift
#
List<String> announcements = new ArrayList<>();
for (String key : spigotConfig.getConfigurationSection("messages").getKeys(false)) {
  announcements.add(spigotConfig.getString("messages." + key);
}``` or the L33T way ```java
List<String> announcements = spigotConfig.getConfigurationSection("messages").getKeys(false).stream()
.map(key -> spigotConfig.getConfigurationSection("messages." + key))
.collect(Collectors.toList());```
quiet ice
#

absolutely no need for latter

sage swift
#

only if you want to be cool

quiet ice
#

And wreck your CPU

small vine
#

alright lets see if my dumbass can get this done

sage swift
#

you will be cool, your cpu will not

#

that's fine

#

lmao

quiet ice
#

But, to be even more performant you can use

List<String> announcements = new ArrayList<>();
var sect = spigotConfig.getConfigurationSection("messages");
for (String key : sect.getKeys(false)) {
  announcements.add(sect.getString(key);
}
sage swift
#

var

#

ConfigurationSection?

quiet ice
#

hey, that is valid java

sage swift
#

what

quiet ice
#

at least for java 10+

sage swift
#

huh

#

wtf

#

i dont like java anymore

quiet ice
#

It is really good for pseudocode like this or if you have a lot of generics

sage swift
#

what does the IDE think of this

quiet ice
#

So Map.Entry<Map.Entry<Map.Entry<Double, Double>, Double>, Player> becomes var

#

It is type inference, so not proper python shit

#

So you cannot reassign the variable with another type afterwards, you could consider it a macro extension for the return type

#

Eclipse deals with it just fine, I would be surprised if IntelliJ was to not be able to deal with it

sage swift
#

so its like the generic T in a method but used as the variable type

#

interesting

quiet ice
#

yes, and it isn't prone to type erasure

sage swift
#

now if only type erasure was explained in a way that i could understand

quiet ice
#

Well, all generics are removed at the bytecode layer, which creates such as massive amount of pain.
So class OptionalPlayer extends Optional<Player> becomes class OptionalPlayer extends Optional

#

which is why you cannot easily create arrays of generics (new HashMap<UUID, Player>[10] is invalid iirc while new HashMap[10] is valid, but will create more compiler warnings)

#

And you cannot do instanceof with generics

#

sun, pls fix generics

hushed thunder
#

i was wondering how to do i create an instance of a class?

quiet ice
#

multiple ways

#

The easiest is just the new operator, but you can also use some reflection hacks

hushed thunder
#

i was trying to register a command

#

this is my code

#
public static void registerCommands(String args) {
  args = "2";
  getCommand("ButterKing").setExecutor(ButterKingCommand.class);
}```
sage swift
#

static

#

no

#

new ButterKingCommand()

undone axleBOT
sage swift
#

?learnjava

hushed thunder
#
public static void registerCommands(String args) {
  args = "2";
  getCommand("ButterKing").setExector(ButterKingCommand.class);
  new ButterKingCommand();
}```
#

is that good?

quiet ice
#

or ButterKingCommand.class.newInstance() could work

sage swift
#

yes perfect that will fix it!

hushed thunder
#

okay thank you

sage swift
#

that is exactly the way you should do it!

quiet ice
#

well, it bypasses the constructor

sage swift
#

wasnt talking about your method of doing it

#

i was talking about what he changed

#

and how it will affect nothing

hushed thunder
#

what?

sage swift
#

you need to use the instance of the class

#

not just instantiate it randomly

quiet ice
#

Right now you are feeding the setExcutor method a Class<ButterKingCommand>, however it expects a ButterKingCommand

hushed thunder
#
public static ButterKingCommand = new ButterKingCommand(); //i did this because it didn't let me put public static in the register commands
public static void registerCommands(String args) {
  args = "2";
  getCommand("ButterKing").setExecutor(ButterKingCommand.class);
}```
#

will that work

sage swift
#

static abuse

#

aaaa

#

you're not changing anything about what executor you're setting

hushed thunder
#

OH i get it

#

lemme see now

quiet ice
#

hold on, getCommand("ButterKing") will not even compile

#

you should be scrapping your entire method, something is wrong there (or just remove the static modifier)

hushed thunder
#

did i fix it

sage swift
#

yes

hushed thunder
#
public static ButterKingCommand = new ButterKingCommand(); //i did this because it didn't let me put public static in the register commands
public static void registerCommands(String args) {
  args = "2";
  nostatic.getCommand("ButterKing").setExecutor(ButterKingCommand.class);
}```
quiet ice
#

if it compiles it is fixed

  • literally every programmer ever
hushed thunder
#

i am coding in notepad

sage swift
#

stop

quiet ice
#

how the hell do you want to compile it then

hushed thunder
#

im using windows vista becuase computer slow

quiet ice
#

then use eclipse

hushed thunder
#

i manually change extension to .class

#

and put into zip

quiet ice
#

Eclipse is age old and will work almost everyhwere

hushed thunder
#

and change .zip to .jar

#

it worked

#

but nothing showed up in console

#

that's why im confused

quiet ice
#

so you manually execute javac of all things

hushed thunder
#

no

#

i get the java class

#

and change from .java to .class

quiet ice
#

ohno

#

that is 5 times worse than what I anticipated

sage swift
#

kek

hushed thunder
#

and then make folders

#

and zip those folders together

quiet ice
#

heck, even javac will do a better job at this

hushed thunder
#

and then turn .zip into .jar

sage swift
#

are we trolling here

quiet ice
#

Use maven please, it saves a lot of trouble for you

#

If you are trolling, then stop

sage swift
#

no no, continue please

#

i love this

quiet ice
#

it has it's charm, yes

wet breach
#

I don't think this is a case of someone actually trolling

edgy goblet
#

what if hes not trolling and youre scaring a new developer

sage swift
#

good

#

natural selection

#

i get paid more

edgy goblet
#

your code sucks

hushed thunder
#

i use windows vista

#

and notepad

#

because notepad++ wont work

sage swift
#

im surprised i havent been banned from any minecraft discords yet

wet breach
quiet ice
#

use an age old eclipse version, it saves a lot of work for you and will work on vista

sage swift
#

this one probably

hushed thunder
#

i tried eclipse but my computer bluescreen when i download

sage swift
#

paper definitely

quiet ice
#

Then use netbeans

sage swift
#

zrips (cmi/jobs, im a helper) yeah probably

hushed thunder
#

i tried intellij and netbeans

wet breach
hushed thunder
#

they all bluescreen

#

notepad is the best anyway

quiet ice
#

Just stay of intelliJ because that will def. kill your PC

wet breach
#

then I think you have some issues with your OS then

hushed thunder
#

okay back to coding

quiet ice
hushed thunder
#
public static ButterKingCommand = new ButterKingCommand(); //i did this because it didn't let me put public static in the register commands
public static void registerCommands(String args) {
  args = "2";
  nostatic.getCommand("ButterKing").setExecutor(ButterKingCommand.class);
}```
#

can anyone help me fix it

sage swift
#

Bukkit.shutdown() on the next line

hushed thunder
#

okay

wet breach
hushed thunder
#
public static ButterKingCommand = new ButterKingCommand(); //i did this because it didn't let me put public static in the register commands
public static void registerCommands(String args) {
  args = "2";
  nostatic.getCommand("ButterKing").setExecutor(ButterKingCommand.class);
  Bukkit.shutdown();
}```
#

anything else?

#

or can in try it

chrome beacon
#

Lmao

hushed thunder
#

it looks good

sage swift
#

that should be good

hushed thunder
#

thank you

quiet ice
#

You need to use maven or javac, otherwise bukkit will be unable to read your class

hushed thunder
#

afk compiling everything

edgy goblet
#

make sure to use gcc

quiet ice
#

well, that is an obvious troll and I'll go now

sage swift
hushed thunder
#

back

#

btw this is paid work

#

someone paid $45

#

for this plugin

stoic osprey
#

why does player.getPing() give me null? the player is the sender

hushed thunder
#

help

chrome beacon
hushed thunder
#

they want the plugin withing the next 5 hours

#

its an anticheat

#

called butterking

#

can someone do it for me

chrome beacon
#

Don't take commissions if you have no idea what you're doing

hushed thunder
#

i have 3 hours of experience

#

but i want money

#

they've already paid please help

chrome beacon
#

You still have no idea what you're doing

#

Refund them

hushed thunder
#

i cant

#

i already spent the money

#

on robux

chrome beacon
#

Bruh

hushed thunder
#

for my cousin

stoic osprey
#

oh wow

chrome beacon
#

Well you're screwed

supple elk
#

can anyone help me structure a database?

hushed thunder
#

what can they do

stoic osprey
#

you'll have to refund them out of your own money?

chrome beacon
#

^^

hushed thunder
#

if they only receive a .txt file

#

i have $0 left

#

cuz i just started my paypal account

stoic osprey
#

Why'd you accept it?

hushed thunder
#

i wanted money

stoic osprey
#

I'd you knew you couldn't do it

craggy cosmosBOT
stoic osprey
#

that's called scamming

chrome beacon
#

Ask your family to lend you some money

hushed thunder
#

i thought anticheat was easy

chrome beacon
#

Bruh

hushed thunder
#

i thought you'd do

chrome beacon
#

You have 3 hours of experience

hushed thunder
#

Bukkit.startAntiCheat("ButterKing");

#

or something

stoic osprey
#

lmao

chrome beacon
#

You better be trolling

stoic osprey
#

I hope so

supple elk
#

bruhhh

hushed thunder
#

im not !!!

stoic osprey
#

It seems kinda sus your situation

hushed thunder
#

why

#

i need help

chrome beacon
#

Well nothing we can do

hushed thunder
#

i honestly need help

#

what can they do

#

can they sue me

#

if i give them a .txt file saying sorryu

quaint mantle
stoic osprey
#

they won't accept that

#

you can't even say you need more time if you only have 3 hours experience

hushed thunder
supple elk
#

then why did you accept payed work

hushed thunder
#

i wanted money

stoic osprey
#

why'd you accept if you have no idea how to code???

supple elk
#

and?

quaint mantle
#

That seems to be your problem. Nobody here is going to code you a plugin for free because you scammed them.

stoic osprey
#

you need to provide what they paid for

supple elk
#

or refund

hushed thunder
#

im not asking for someone to code it for me

quaint mantle
#

Please move the conversation to something else.

hushed thunder
#

i cant refund i have $0 left

stoic osprey
#

._.

hushed thunder
#

i need suggestions

#

of what to do

supple elk
#

then get somebody else to help you like parents

hushed thunder
#

im stressing

stoic osprey
#

there isn't much you can do

supple elk
#

or get a loan from a friend

quaint mantle
#

Talk to your parents, explain it to them, have them pay it back and pay back your parents.

#

We are not a bank

stoic osprey
#

^

hushed thunder
#

my heart rate is at 189

quaint mantle
#

Please move the conversation to development questions.

quiet ice
#

Bank of spigot

stoic osprey
#

🤣

quiet ice
#

Is there a plugin called like that?

hushed thunder
#

please someone give me suggestions on what to do

supple elk
#

we already have

quaint mantle
#

Speaking of, anyone has a clue how to make a shaped recipe but require the itemstacks to have a certain value is a pdc?
I cannot seem to make a custom recipe (where the items within are custom too)

hushed thunder
#

i cant refund

stoic osprey
#

best thing to do is to own up to parents and get a loan

quiet ice
hushed thunder
#

my parents died when i was 3 in a car crash

quiet ice
#

okay, obvious troll, please stop

wraith rapids
#

git gud scrub

hushed thunder
#

no ):

#

im sad about them

quiet ice
#

you are doing nothing for the good of humanity

quaint mantle
#

This is harsh but we don't care.
Please refrain from continuing this conversation and head to the forums.

wraith rapids
#

consider selling some organs on the black market for money

quaint mantle
wraith rapids
#

i heard kidneys sell well

hushed thunder
#

i buried them in my sink because i go there the most to drink

quiet ice
wraith rapids
#

we have 5 times more people enforcing them now

#

but it's still not enough

quaint mantle
wraith rapids
#

i can't see replies

quaint mantle
#

Speaking of, anyone has a clue how to make a shaped recipe but require the itemstacks to have a certain value is a pdc?
I cannot seem to make a custom recipe (where the items within are custom too)

hushed thunder
#

can someone preform a ritual on my parents to revive them so i can ask them for a loan so i can refund my customer so they don't get mad?

sage swift
#

RecipeChoice.ExactChoice

wraith rapids
#

use exactchoice

sage swift
#

you fool

#

i win

wraith rapids
#

it takes into account metadata

quaint mantle
#

Yeah, I did that.. it doesn't resolve anything, let me post my code 😦

hushed thunder
#

you can unrevive them after i ask for a loan if u want

quaint mantle
#

I can use normal items too for some odd reason

quiet ice
quaint mantle
#

?paste

undone axleBOT
wraith rapids
#

prostitution probably

quaint mantle
quiet ice
#

I heard that jail was a nice place

hushed thunder
#

i got the money from the customer buying my anticheat before i started

stoic osprey
#

If your parents died then tell your guardian @hushed thunder

hushed thunder
#

i dont have one

#

i am 27

quaint mantle
#

@hushed thunder Shut the hell up, we do not care.

supple elk
#

then get a real job

#

and pay them

hushed thunder
quiet ice
#

you do not get any money from development in the first place

hushed thunder
#

fat

quaint mantle
#

Guys, stop replying.. they just want attention..

sage swift
#

don't set an item directly

quaint mantle
sage swift
#

set an item to a new ExactChoice

stoic osprey
sage swift
#

then use the ExactChoice

hushed thunder
#

give me anti fat pills

quaint mantle
#

Can you write some pseudo, I don't understand 100%

chrome beacon
quaint mantle
#

I don't require a 🥄 but just... pseudo 🙂

hushed thunder
#

give me anti fat pills so i can get a job so i can refund my customer so they wont sue me so i wont go into debt so i can live a happy life

wraith rapids
#

looking at the code they seem to be using the exactchoice right

sage swift
#

No he's just putting materials in directly

wraith rapids
#

summonerRecipe.setIngredient('q', new RecipeChoice.ExactChoice(miniboss.itemManager.createFleshItem(1)));

#

in part yes

supple elk
#

Can anyone help with a database design?

sage swift
#

Oh

wraith rapids
#

but some of the choices are exactchoices

#

this should work afaik

hushed thunder
#

please help

sage swift
#

to be honest for custom crafting you might as well just put the recipes into an existing custom crafting plugin

supple elk
#

Currently I have that but the problem is that each game stores different values for it's map

torn oyster
supple elk
torn oyster
#

oh they left

chrome beacon
#

Finally

supple elk
#

god

wraith rapids
#

imagine if there were mods

torn oyster
#

why shouldn't i help them

supple elk
#

read up

torn oyster
#

ok

quaint mantle
sage swift
#

spigot api is all you need

#

what doesn't work?

quaint mantle
#

You can use normal bones instead of demonic bones.

wraith rapids
#

like, afaik this should work

quaint mantle
#

And 9 demonic bones craft 1 demonic bone.

amber vale
#
    
    public void onPlayerTakeDamage(EntityDamageEvent e) {
        Bukkit.getConsoleSender().sendMessage("Ayo player took damage");
        Player p = (Player) e.getEntity();
        
        Main instance = Main.getInstance();
        
        RPGPlayer pRPG = instance.getPlayerMap().get(p.getUniqueId());
        
        pRPG.setHp(pRPG.getHp() - (float) e.getDamage() * (100/(100 + pRPG.getDefense())));
        
        ActionBarUtils.sendActionBarMessage("HP: " + pRPG.getHp() + "/" + pRPG.getMaxHp(), p);
        
    }
    
}```
torn oyster
#

this guy seems innocent what

#

oh wait nvm

amber vale
#

This dont work

quaint mantle
#

Which shouldn't be the case

wet breach
north spire
#

Hello, I am new in spigot development

quaint mantle
north spire
#

And I want to ask howto update scoreboard ?

#

My scoreboard can't update on death

wraith rapids
#

although...

#

where are the itemstacks

north spire
wraith rapids
#

i'm not seeing you actually instantiating any new items

quaint mantle
sage swift
#

it makes sense that the demonic bones can be used as bone material

wet breach
# supple elk yes

ok, then you should create a list of all the things you want to save in the data base. Once you have that, start grouping similar type things together. Then, you need to figure out how if you need an index or not. If the data is mostly static, an index will be beneficial.

supple elk
amber vale
wet breach
#

oh that is going to be easy then

prisma badge
#

hello guys

amber vale
#

Why doesnt this work?

prisma badge
#

i am new with spigot

supple elk
#

however each game's map stores different values

quaint mantle
wet breach
supple elk
#

so like for 1 game each map will need to store x and y

#

because I need different fields

prisma badge
#

k

#

so um

wet breach
#

so invert your data @supple elk

supple elk
craggy cosmosBOT
wet breach
#

instead of making tables for each game, make tables for each map instead

prisma badge
#

btw guys do you like my username

#

i really love it

amber vale
quiet ice
#

slash commands do not work

quaint mantle
# prisma badge so um

Please reply in a single messazge, as you see, they go fast here about multiple topics. useless messages are considered spam.

amber vale
#

This used to be an useful server but now im just being ignored -_-

supple elk
prisma badge
#

btw guys do you like my username
i really love it

wraith rapids
#

this rainbow guy seems like a sock

wet breach
#

sure

quaint mantle
#

yeah, he is a sock

prisma badge
#

sock?

quaint mantle
#

for sure

prisma badge
#

what does that mean

quaint mantle
prisma badge
#

what does sock mean plz tell me i feel offended

chrome beacon
wraith rapids
#

i'm a pretty offensive guy

chrome beacon
#

I'm becomming one too... I used to be more chill

wraith rapids
#

that's just your internal evolution towards zen taking its due course

quiet ice
#

Spigot is not good for our mental health

wraith rapids
#

you will learn, given time, that nothing matters

prisma badge
#

why isn't this working

            for (String s : HubPvP.getPlugin().getConfig().getStringList("disabled-worlds")) {
                if (s.equalsIgnoreCase(world)) {
                    e.setCancelled(true);
                }
            }```
wraith rapids
#

the least of all the stupid opinions of people

quaint mantle
prisma badge
#

world is a variable

quiet ice
#

explain "not working"

prisma badge
#

it just isnt working

chrome beacon
#

Also whole code in a paste

quaint mantle
undone axleBOT
wraith rapids
#

is world a string?

quiet ice
#

it needs to be

quaint mantle
#
  1. Show us the full code, not a snippet
  2. Explain what goes wrong, got any errors?
quiet ice
#

otherwise it wouldn't compile

wraith rapids
#

equals accepts an object

quiet ice
#

its equalsingorecase

wraith rapids
#

oh right that' equalsignorecase

prisma badge
#

paste isnt working for me

wraith rapids
#

nevermind

chrome beacon
#

Find another paste site then...

wraith rapids
#

that code will perform horribly by the way

torn oyster
#

@prisma badge i can fix it

#

dm me

prisma badge
#

okay well @torn oyster fixed it

#

thank you again lach

torn oyster
#

yw

wraith rapids
#

use a precomputed set

prisma badge
#

what?

wraith rapids
#

ideally a weak ref set of world instances

quiet ice
#

A HashSet if you will

#

Make sure to always call .toLowerCase or similar, otherwise the case will matter

wraith rapids
#

strings do cache hashcode but in case of hash collisions the entire string needs to be compared

quaint mantle
#

String comparison can indeed be a performance killer 🙂

icy laurel
# prisma badge why isn't this working ```java for (String s : HubPvP.getPlugin().ge...

I don't know where you are using this, but if you use it in PlayerMoveEvent etc, RIP. I'd suggest creating a HashSet with all worlds (World, not String) in this config using Bukkit.getWorld(/*worldname*/), and then check with HashSet.contains(/*world object*) if the world is disabled. You really don't want to do it with strings comparisons, like a lot of other people here said already

rigid otter
#

Hello! Anyone know where to apply PlayerInteractManager(EntityPlayer) in 1.17? I create NPCs.

  • In 1.16, new EntityPlayer(MinecraftServer, WorldServer, GameProfile, PlayerInteractManager(WorldServer));
  • But now(1.17), new EntityPlayer(MinecraftServer, WorldServer, GameProfile); there is no PlayerInteractManager parameter, so where to apply that?
chrome beacon
#

NMS isn't really supported

wet breach
#

this is the thing with NMS, it changes so you will have to adapt with it

rigid otter
#

No longer need, but my NPC does not work like before

wet breach
#

we unfortunately can't help that

rigid otter
#

It disapear

rigid otter
quaint mantle
#

its created in the constructor by default now

#

this.gameMode = minecraftserver.createGameModeForPlayer(this);
with mojang mappings looks like you need

#

not sure what anyone would be doing with that class tho

rigid otter
#

Ok, maybe another problem with me so, because of the change

quaint mantle
#

I see some github projects call methods but you can do that anyway since its variable is public

rigid otter
#

And does it stop using f**king package name with version right now in 1.17?

chrome beacon
rigid otter
#

Yeah, but bukkit still uses the old

#

org.bukkit.craftbukkit.v1_17_R1...

chrome beacon
#

CraftBukkit yeah not NMS

quaint mantle
#

its still in transition phase

#

It's very possible things can change

quaint mantle
#

[Help with reflection]
Hello, i'm getting String field with reflection. my code: Field field = PacketPlayOutChat.class.getDeclaredField("a"); field.setAccessible(true); but how to get this field's string?

#

I need object to field.get(obj);

#

but what object should I put?

weary geyser
#

null

quaint mantle
#

when I use null

weary geyser
#

field.get(null);

quaint mantle
#

(NullpointerExp)

#

ahh

keen kelp
#

Does Bukkit#DispatchCommand return anything if the command doesn't exisit?

#

or is that impossible

quaint mantle
#
                    Bukkit.broadcastMessage(field.get(null) + ">");```
weary geyser
#

The field is null then idk

#

Why do you even want that

quaint mantle
#

I'm getting PacketPlayOutChat's a field

weary geyser
#

Why do you want the IBaseChatComponent of that packet

#

Yes but why

quaint mantle
#

here

#

it's my help thread

weary geyser
#

Hm I don't know

wispy plume
#

What's the pitch of NOTE_PLING sound in Hypixel's bedwars shop?

chrome beacon
#

🤷‍♂️ You could always make a quick mod and check

keen kelp
#

Is it possible to tell if a command has run successfully?

#

Im trying to make a /loop command, and I feel like it's not right to spam Unknown command a ton of times if the user typed smth wrong

weary geyser
#

Add a syntax check

keen kelp
#

how does one do that?

#

/loop 100 hi
this way they would be spammed by 100 of those Unknown command messages

#

which is annoying

weary geyser
#

Wait wdym

wispy plume
#

ik why xd

#

hi is not a command

#

do /loop 100 say hi

keen kelp
#

yep

wispy plume
#

xd

keen kelp
#

ik

weary geyser
#

Aha

#

Loop commands

keen kelp
#

yep

weary geyser
#

Well check if args[1] is a command

keen kelp
#

I just do Bukkit#Dispatch

#

I feel like a better way is just to compact the responses

#

how do I check if it's a command

weary geyser
keen kelp
#

I see

#

I think I know what it's doing

#

is it possible to disable the command feedback in the first place tho

weary geyser
#

Yes through the spigot config

keen kelp
#

I dont want every single one to do that :/

#

I only wanted the ones running though loop to do that

dusty sphinx
#

How can I see if a Server has the settings-bungeecord key set to true in spigot.yml? I've seen Spigot.Server.getConfig, but Server.spigot() doesn't work for me.

weary geyser
dusty sphinx
#

yeah im aware

#

i do Bukkit.getServer(), which gives me my server, but from there I can't do .spigot(), is there something I'm missing?

weary geyser
#

Works for me

#

What version are you using

dusty sphinx
#

API Version 1.17-R0.1-SNAPSHOT

weary geyser
#

¯_(ツ)_/¯

#

It might have been removed idk

dusty sphinx
#

hmm

#

its like there in the documentation

weary geyser
#

?jd

dusty sphinx
weary geyser
#

the non-static method spigot() from the Server class returns the Spigot sub-class of that class

#

So like idk your IDE might be trippin'

dusty sphinx
#

in that case maven is trippin' too because im failing to build

weary geyser
#

Hm

chrome beacon
dusty sphinx
#
<repositories>
    ...
    <repository>
        <id>spigot-repo</id>
        <url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
    </repository>
    ...
</repositories>
<dependencies>
    ...
    <dependency>
        <groupId>org.spigotmc</groupId>
        <artifactId>spigot-api</artifactId>
        <version>1.17-R0.1-SNAPSHOT</version>
        <scope>provided</scope>
    </dependency>
    ...
</dependencies>
#

I'm aiming for 1.13-R0.1-SNAPSHOT but I can't seem to find the docs for that API version

keen kelp
#

how do i get started on auto complete/prompts for commands

manic furnace
#

Is there a way that i can get the client typ of a player?

keen kelp
#

by client type you mean?

#

Vanilla/Optifine/Forge?
Or like minecraft versions

manic furnace
#

If the player use forge or vanilla

#

For example

keen kelp
#

Well forge sents packets to the server for what mod is installed

#

idk about others tho

#

It relies on the client sending something to the server

#

which can be easily mitigated

#

so if you expect it to block people with malicious intent, you can't

#

anyone who wants to do it can do it

manic furnace
#

Ok

keen kelp
#

You can do this if you sinply want to block non-malicious mods that just does things you dont like

#

But just to mind you, do not rely on this for anti cheat

#

it's easily spoofed

keen kelp
#

Is it possible to make a command's argument to only take numbers and make the command red when it's wrong?

ivory sleet
#

Java docs or just the dependency @dusty sphinx ?