#help-development
1 messages · Page 1521 of 1
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
sort the friends, then populate the inventory from that sorted list
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
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
you don't want to check if the item is similar
Code blocks smh
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
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
Something like that: List<Boolean> definedOrder = Arrays.asList(true, false);
sort the fucking string list
Something like that: List<String> definedOrder = Arrays.asList("§8[§aOnline§8]", "§8[§cOffline§8]");
are you trying to sort them based on who is online and who is not
yea
heres the code https://paste.md-5.net/dugabagija.cs (With the itemstack builder)
Comparator.comparingInt((player) -> player.isOnline() ? 0 : 1)
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
addItem(s)
the method returns a Map of the items that didn't fit
drop those items on the floor
okay thx but how is it gonna help me i just want to know how to sort the items based on the itemstacks name
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);
Comparator.comparing((item) -> item.methodToGetItemStackName())
okay im trying it thx and sry im not so long in the java scene im trying my best
HashMap<Integer, ItemStack> leftOvers = target.getInventory().addItem(normal);
so this returns the leftovers?
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.
@wraith rapids ive done this ItemStack itemStack = buildFriend(friendInfo);
Comparator.comparing((item) -> itemStack.getItemMeta().getDisplayName());
Collections.sort(list, comparator)
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));
}
all those tabs hurt my soul
System.out.println(leftOvers.keySet().size());
this always returns -
returns 0*
leftOvers.values().forEach((stack) -> drop stack)
if the map is empty then all of the items were fit in the inventory
it might not like stack sizes of 5k
what are you doing then
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.
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
show code
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
if anyone gets a chance to glance at my code, please shoot me a ping, I don't look at discord much
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
@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");
}
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)
Not sure if this was resolved. He's not using GroupManager, thats Multiverse Inventories
does anyone know why my inv isnt sortet https://paste.md-5.net/edifibowet.cpp
Error: If you wish to use IP forwarding, please enable it in your BungeeCord config as well!
I have true
Version spigot 1.17
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.
Already tired that and it changes nothing
Send gradle logs?
Ah, found the setting in IntelliJ
Ah, IntelliJ uses different settings that what you define in Gradle, I hate it
Oh
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)
That's annoying
bump
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?
help
Only if you give me more info than "help"
in #help-server
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
Is this happening in code you're writing or just in your server?
the server
So, turns out suspicious stew is disguised as a recipe for "air". Looks like the only way to "disable" it is by a craft event or removing all recipes that result in air, though that may cause side effects.
this is on client
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
there isnt
Can you send the line above the NullPointerException?
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
How much more WARN or ERROR is there above that?
[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
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
Paper doesnt like NMS
so paper isnt an option
and i JUST built spigot
im restarting server
can someone help me with this?
Have you tried the restart? Also, spigot got a push 30 minutes ago. Not sure it's relevant though.
i just rebuilt spigot
@valid totem what did u type before u edit?
that would just give dirt
yeah
i dont want to creat a new one every time i add a new item at the gui shop
p.getInventory()
.addItem(
new ItemStack[] {new ItemStack(Material.DIRT, 64)}
);
oh that
That may not be what you want, but that's how the syntax works
ok
No luck on the restart?
thanks i will just use that
ok i just restarted server still getting error
Damn, are you able to try deleting the world folder? If it has precious data, rename it to "old_world" then try a restart
Same diff
ok im restarting
how can I register a tab complete for commands I made with the plugin mycommands?
oof still not working
should i use p.updateInventory();
after?
You got any mods?
Maybe, can you send a plugin list?
kk
Prolly, maybe not, try it yourself? 😛
Is this just a plugin you're using or are you a developer hooking into its API?
If you're temp banning through essentials then its an essentials problem
plugin im using
im temp banning through my plugin
Bukkit.getBanList(Type.NAME).addBan(banning.getName(), banReason, unbanTime.getTime(), "");
my line of code
it uses the bukkit ban system
its not my plugin
ye but somewhere in your code you're going out of bounds on an array
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
ight
So, those devs seem to accept support through their Bukkit page: https://dev.bukkit.org/projects/mycommand. I'd ask them if it's a supported feature yet
Try removing the hhlsmc command real quick
and i cant do anything about it
they do have this feature /mycmd-edit add_permission tab_completer
then how do i temp ban
and this /mycmd-edit links tab_completer_display_mode
Well, this is just a troubleshooting step
.
there isnt a vaniila temp ban command
So are you trying to make your own ban command?
there's other ban plugins out there
ok i just remove my plugin
and i added essentaisl back
same error
same stack trace
its just NMS code
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
I can't find anything in their docs, I'd ask the developer or dive into their source code if it's available
Pretty texh saavy
Tech
I tried everything already
I tried removing plugins already
Its still the same error
maybe try in a completely new folder w/ a fresh server .jar
I dont think i had this error with 1.16
Has anyone in here managed to increase the max build height of a 1.17 Spigot server?
bruh
Go to slicedlime’s repository for vanilla worldgeb
1st link on google for "datapacks minecraft": https://minecraft.fandom.com/wiki/Data_Pack
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.
Then modify the height attribute
Just tried in 1.16 server jar, no problem
Its just 1.17 nms
I don't get it lol
When i get back home i will make a pack and send a google drive link
Any plugin that uses NMS and is written for 1.16 will not work on 1.17
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
spigot not longer has mappings for nms
eventually it will implement the Mojang mappings
Decompiling sucks
what do i put for a potion cause material doesnt do it . what type is it?
google doesnt help either idk what to google
ok
declaration: package: org.bukkit.inventory.meta, interface: PotionMeta
nvm fixed it, got a datapack 👍
how do we check if the player's offhand item is nothing/null
will never be null
just check if type is air
(at least, will never be null in paper. not too sure about spigot)
if(!(offHand == null && offHand.getData().getItemType().equals(Material.AIR))) {
doesn't work
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
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.
This isn't what you posted first. Your original was all wrong.
No, the first one is logically incorrect
OK, be rude and don;t learn
go read yrou first post again and see what you did wrong
certainly won't learn from a beginner like u
go learn java before trying to give advice<
Yep, complete beginner here.
talking bout you :)
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
I put a ! in the beginning buddy
yep, that's how java works -_-
No its not
The internal scope of your logic is tested together, so IS null and type is air
yes, but that is NOT what you wrote
it IS
( -----------> !(offHand == null && offHand.getData().getItemType().equals(Material.AIR))) <------
you wrote if (NOT(hand is null, AND its type is air)
exactly
I'll let you look over that and see where you went wrong
it passes thru both if statements anyways so they are equivalent buddy
(!(offHand == null) && (offHand.getData().getItemType().equals(Material.AIR)))
is how it should be
?
yes
but with another ! before the AIR check<
but that's exactly what my other if statement is
still went thru tho :/
its not what your statements logic does
Learn some manners dick. Thats THREE people who have told you are wrong and you still insist you are correct
yes he was
and AvroVulcan before me
oh My its another Floofy
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
are you simply tryign to test its not null and not air?
yes.
generally not wise to call people names here 🙂
Anyways, lets move on and figure out the problem at hand 😉
❤️
then if (hand != null && !hand.getType().equals(Material.AIR))
will pass if its NOT null and its NOT air
no look again
you don;t use getData().getItemType()
?
its an ItemStack you simply use item.getType()
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?
Where is announcer.txt?
After you call saveDefaultConfig() in yoru startup you can then test for the announcer file if if its not there use saveResource("announcer.txt") to pull it from your jar
I didn't use the built in config method. I've set up a text reader manually.
then manually create your folders and use saveResource
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!
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
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)
and md5 said it, you can use maven to move your jar after its done 😉
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
?paste (or codeblocks)
i told u earlier 🤣 u need 2 import th stuff u use
it is already imported tho
its not tho
no u only import javaplugin
show us where u import eventhandler
u need eventhandler
look
again, you didnt import eventhandler
what link
do
i
need
to
import
bruh 🤣
?maven
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
java yes, plugins 0%
which should b plural
oh yeah, ignore me
then u should kno wat an import is 🤣
you just dont have an import
dont ignore this, i was using python for 6 months
so i kinda forgot
how to use java
bows down n begs for his life for ignorin lord n saviore md
5
save me and teach
also how come intellij isnt underlining errors
idk
ok so "@EventHandler" is a bukkit thing so u need an import statement or u cant use it
im not getting auto fill in intellij so ur gonna have to tell me what to type
import org.bukkit.event.EventHandler;
^ literally this 🤣 no link
it has org. thats a "link"
Guys
Implements Listener
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
Bruh
<< dies irl
^
Enables Auto imports. Confirm your dependencies. Never worry about it again.
wtf, I didn't know intellij had auto import :0
Ye
I literally have done nothing but auto import
I've never had to write out an import lol
it fails on me sometime ;-; most th time it works doe
eh, i like vscode, but not for java
Oh it's definitely fucky
but close and open a couple times and you'll get it 100% of the time 75% of the time
fucky covers it yes 😄
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
thonk
how do you guys have issues like this
intellij would def error if it didn't recognize an import
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();`
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);
Creative mode is fucky
creative mode is client controlled
ah, okay.
Have you cancelled the click event though
Md_5 can correct me obviously but I believe click events are still server side
Yes, I tried with and without cancelling it
is there any way to run the plugin in the IDEs? Like you can do with mods
for debugging purposes
You can attach the debugger remotely
make the code in it faster
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
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
wasn’t expecting you here 😮
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
getConfigurationSection
I'll try to wrap that in an array then? I'll give it a go
??
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?
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
what's that false doing at the end? whats that for?
deep, meaning if i have nested sections it would get all the keys
cool
section1:
section2:
section3: {}``` section1.getKeys(true) would return section2 and section3
ow
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
@waxen plinth's RedLib has NMSHelper which is pretty good 🙊
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
do u even really need an nms wrapper
With Scoreboard teams, is it possible to make the team#setColor to access hex colours?
Well... that's annoying
but doesnt it not even take a color?
i dont remember there being 16 glow colors
It's for name color
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
yes, I use the getKeys method, then using those keys to fetch the data
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());```
absolutely no need for latter
only if you want to be cool
And wreck your CPU
alright lets see if my dumbass can get this done
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);
}
hey, that is valid java
what
at least for java 10+
It is really good for pseudocode like this or if you have a lot of generics
what does the IDE think of this
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
yes, and it isn't prone to type erasure
now if only type erasure was explained in a way that i could understand
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
i was wondering how to do i create an instance of a class?
multiple ways
The easiest is just the new operator, but you can also use some reflection hacks
i was trying to register a command
this is my code
public static void registerCommands(String args) {
args = "2";
getCommand("ButterKing").setExecutor(ButterKingCommand.class);
}```
Here are some links to get you started on learning Java:
- https://www.codecademy.com/learn/learn-java
- https://www.sololearn.com/learning/1068
- https://www.learnjavaonline.org/
- https://programmingbydoing.com/
- https://docs.oracle.com/javase/tutorial/java/index.html
The last one is the only official one, however some of those concepts assume that you already know a bit about programming.
?learnjava
public static void registerCommands(String args) {
args = "2";
getCommand("ButterKing").setExector(ButterKingCommand.class);
new ButterKingCommand();
}```
is that good?
or ButterKingCommand.class.newInstance() could work
yes perfect that will fix it!
okay thank you
that is exactly the way you should do it!
well, it bypasses the constructor
wasnt talking about your method of doing it
i was talking about what he changed
and how it will affect nothing
what?
Right now you are feeding the setExcutor method a Class<ButterKingCommand>, however it expects a ButterKingCommand
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
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)
did i fix it
yes
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);
}```
if it compiles it is fixed
- literally every programmer ever
i am coding in notepad
stop
how the hell do you want to compile it then
im using windows vista becuase computer slow
then use eclipse
Eclipse is age old and will work almost everyhwere
and change .zip to .jar
it worked
but nothing showed up in console
that's why im confused
so you manually execute javac of all things
kek
heck, even javac will do a better job at this
and then turn .zip into .jar
are we trolling here
it has it's charm, yes
I don't think this is a case of someone actually trolling
what if hes not trolling and youre scaring a new developer
your code sucks
im surprised i havent been banned from any minecraft discords yet
no need to start a flame with Gecko 😉
should you be?
use an age old eclipse version, it saves a lot of work for you and will work on vista
this one probably
i tried eclipse but my computer bluescreen when i download
paper definitely
Then use netbeans
zrips (cmi/jobs, im a helper) yeah probably
i tried intellij and netbeans
There is other IDE's you can try, like Netbeans or IntelliJ
Just stay of intelliJ because that will def. kill your PC
then I think you have some issues with your OS then
okay back to coding
it's vista, one of the worst Windows releases
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
Bukkit.shutdown() on the next line
okay
even then, I have had a working Vista OS and don't really see how eclipse, intelliJ or netbeans would cause bluescreens on their own.
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
Lmao
it looks good
that should be good
thank you
You need to use maven or javac, otherwise bukkit will be unable to read your class
afk compiling everything
make sure to use gcc
well, that is an obvious troll and I'll go now
why does player.getPing() give me null? the player is the sender
help
Feel bad for them tbh
they want the plugin withing the next 5 hours
its an anticheat
called butterking
can someone do it for me
Don't take commissions if you have no idea what you're doing
Bruh
for my cousin
oh wow
Well you're screwed
can anyone help me structure a database?
what can they do
you'll have to refund them out of your own money?
^^
if they only receive a .txt file
i have $0 left
cuz i just started my paypal account
Why'd you accept it?
i wanted money
I'd you knew you couldn't do it
that's called scamming
Ask your family to lend you some money
i thought anticheat was easy
Bruh
i thought you'd do
You have 3 hours of experience
lmao
You better be trolling
I hope so
bruhhh
im not !!!
It seems kinda sus your situation
Well nothing we can do
i honestly need help
what can they do
can they sue me
if i give them a .txt file saying sorryu
@hushed thunder This chat is not the place to ask for a development.
Please head to this location: https://www.spigotmc.org/forums/hiring-developers.55/
they won't accept that
you can't even say you need more time if you only have 3 hours experience
i dont want development i want help because i started paid work with someone but i dont know how to code
then why did you accept payed work
i wanted money
why'd you accept if you have no idea how to code???
and?
That seems to be your problem. Nobody here is going to code you a plugin for free because you scammed them.
you need to provide what they paid for
or refund
im not asking for someone to code it for me
Please move the conversation to something else.
i cant refund i have $0 left
._.
then get somebody else to help you like parents
im stressing
there isn't much you can do
or get a loan from a friend
Talk to your parents, explain it to them, have them pay it back and pay back your parents.
We are not a bank
^
my heart rate is at 189
Please move the conversation to development questions.
Bank of spigot
🤣
Is there a plugin called like that?
please someone give me suggestions on what to do
we already have
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)
i cant refund
best thing to do is to own up to parents and get a loan
I do not, but I believe that this should be possible
my parents died when i was 3 in a car crash
okay, obvious troll, please stop
git gud scrub
you are doing nothing for the good of humanity
This is harsh but we don't care.
Please refrain from continuing this conversation and head to the forums.
consider selling some organs on the black market for money
i heard kidneys sell well
i buried them in my sink because i go there the most to drink
If only we had someone to enforce them
@wraith rapids You are a very smart man, idea on this?
i can't see replies
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)
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?
RecipeChoice.ExactChoice
use exactchoice
it takes into account metadata
Yeah, I did that.. it doesn't resolve anything, let me post my code 😦
you can unrevive them after i ask for a loan if u want
I can use normal items too for some odd reason
where do you get money from in the first place
?paste
prostitution probably
https://paste.md-5.net/asarovecik.java
Usage of normal bones / rotten flesh still works.
I heard that jail was a nice place
i got the money from the customer buying my anticheat before i started
If your parents died then tell your guardian @hushed thunder
@hushed thunder Shut the hell up, we do not care.
no every job declines me cuz im fart
you do not get any money from development in the first place
fat
Guys, stop replying.. they just want attention..
don't set an item directly
Oh?
set an item to a new ExactChoice
ok so what do you want us to do?
then use the ExactChoice
give me anti fat pills
Can you write some pseudo, I don't understand 100%
Just ignore him
I don't require a 🥄 but just... pseudo 🙂
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
looking at the code they seem to be using the exactchoice right
No he's just putting materials in directly
summonerRecipe.setIngredient('q', new RecipeChoice.ExactChoice(miniboss.itemManager.createFleshItem(1)));
in part yes
Can anyone help with a database design?
Oh
please help
to be honest for custom crafting you might as well just put the recipes into an existing custom crafting plugin
Currently I have that but the problem is that each game stores different values for it's map
what with?
don't
oh they left
Finally
god
imagine if there were mods
why shouldn't i help them
read up
ok
I thought of using those, but I want it to not require external plugins, I'll look around for an api 🙂
You can use normal bones instead of demonic bones.
like, afaik this should work
And 9 demonic bones craft 1 demonic bone.
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);
}
}```
This dont work
Which shouldn't be the case
data base design is about table layouts and the sorts
Hello, I am new in spigot development
🎉
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
i'm not seeing you actually instantiating any new items
They get returned, here is the class that makes them.https://paste.md-5.net/iguxoposum.cpp
it makes sense that the demonic bones can be used as bone material
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.
well I want to store a list of a games and a list of maps for each game
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
oh that is going to be easy then
hello guys
Why doesnt this work?
i am new with spigot
however each game's map stores different values
🎉
why is this a problem?
so like for 1 game each map will need to store x and y
because I need different fields
so invert your data @supple elk
invert?
instead of making tables for each game, make tables for each map instead
https://pastebin.com/RT1u3ATS
Exlpain why this doesnt work?
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
slash commands do not work
Please reply in a single messazge, as you see, they go fast here about multiple topics. useless messages are considered spam.
This used to be an useful server but now im just being ignored -_-
can we do this in a dm? kind of crowded here
btw guys do you like my username
i really love it
this rainbow guy seems like a sock
sure
yeah, he is a sock
sock?
for sure
explain
what does that mean
Did you forget your @EventHandler or forget to register your events??
@amber vale
what does sock mean plz tell me i feel offended
It's almost like we didn't get any info
i'm a pretty offensive guy
I'm becomming one too... I used to be more chill
that's just your internal evolution towards zen taking its due course
Spigot is not good for our mental health
you will learn, given time, that nothing matters
why isn't this working
for (String s : HubPvP.getPlugin().getConfig().getStringList("disabled-worlds")) {
if (s.equalsIgnoreCase(world)) {
e.setCancelled(true);
}
}```
the least of all the stupid opinions of people
add " " to world in if statement
world is a variable
explain "not working"
it just isnt working
Also whole code in a paste
?paste
is world a string?
it needs to be
- Show us the full code, not a snippet
- Explain what goes wrong, got any errors?
otherwise it wouldn't compile
oh dang im a dumb fuck
equals accepts an object
its equalsingorecase
oh right that' equalsignorecase
paste isnt working for me
nevermind
Find another paste site then...
that code will perform horribly by the way
yw
use a precomputed set
what?
ideally a weak ref set of world instances
A HashSet if you will
Make sure to always call .toLowerCase or similar, otherwise the case will matter
strings do cache hashcode but in case of hash collisions the entire string needs to be compared
String comparison can indeed be a performance killer 🙂
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
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?
NMS isn't really supported
It would appear it is no longer needed
this is the thing with NMS, it changes so you will have to adapt with it
No longer need, but my NPC does not work like before
we unfortunately can't help that
It disapear
Okay
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
Ok, maybe another problem with me so, because of the change
I see some github projects call methods but you can do that anyway since its variable is public
And does it stop using f**king package name with version right now in 1.17?
Yes it uses official package names now
CraftBukkit yeah not NMS
[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?
null
field.get(null);
Does Bukkit#DispatchCommand return anything if the command doesn't exisit?
or is that impossible
hmmm server kicks me (Npe)
Bukkit.broadcastMessage(field.get(null) + ">");```
I'm getting PacketPlayOutChat's a field
here
it's my help thread
Hm I don't know
What's the pitch of NOTE_PLING sound in Hypixel's bedwars shop?
🤷♂️ You could always make a quick mod and check
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
Add a syntax check
how does one do that?
/loop 100 hi
this way they would be spammed by 100 of those Unknown command messages
which is annoying
Wait wdym
yep
xd
ik
yep
Well check if args[1] is a command
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
This might help https://www.spigotmc.org/threads/check-if-command-exists-on-server-with-arguments.176774/
I see
I think I know what it's doing
is it possible to disable the command feedback in the first place tho
Yes through the spigot config
I dont want every single one to do that :/
I only wanted the ones running though loop to do that
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.
getServer().spigot().getConfig() in the main class
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?
API Version 1.17-R0.1-SNAPSHOT
?jd
declaration: package: org.bukkit, interface: Server
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'
in that case maven is trippin' too because im failing to build
Hm
Could you send your POM
<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
how do i get started on auto complete/prompts for commands
Is there a way that i can get the client typ of a player?
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
Ok
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
Is it possible to make a command's argument to only take numbers and make the command red when it's wrong?
Java docs or just the dependency @dusty sphinx ?