#help-development
1 messages · Page 2092 of 1
I do this lmao
I do it when it's needed
yep its set
when customers are like "what's an sql"
Mainly uhh
I'm just a really big fan of binary data
Binary formats are so easy to read
When your decoder and parser are the same object :3
and then you theorize for 3 hours on how to lower the file size from 110kb to 90kb
How to turn a player item into nothing
setItem(slot, null)
Like He has a Apple on hand and i want to remove it from them
removeItem(new ItemStack(Material.APPLE))
lmao ye
you can do some cool shit like uhh
bitmasks
use getEquipment().getMainHand or just player#getMainHand() then use illusions methods
just use bytes
cant remember which method it is for main hand
why save a uuid by its string form? just write its longs
getItemInMainHand
I can't tell if you're a noob or just a 2015 developer
2015 was the best years no cap
I believe you can represent a UUID as 4 bytes? I don't remember, but I think that's the case.
you can represent it as 2 longs
Oh so uhh
now you gotta getView() then get its name sadge
16 bytes?
which is closer to like 16 bytes yeah
I remember doing them maths
32 characters = 64 bytes (utf-8 encoding and such)
- 1 byte for string length
or 4 if you're using an int
Well you can represent a character as a single byte
I believe shorts are for UTF-16
if you have a predefined alphabet string
and just save the indexes of each character
which is how you efficiently store player names btw
yo
yo home slice
how may we assist you today my G
sorry that was uncharacteristic of me lmao
whats up?
Sooooooooo I'm spawning projectiles, right
We're having a huge blast
With "wands" that shoot arrows lol
Thing is
We sit on a pile of arrows now.
Can i make them projectiles stay on the ground? Not being able to be picked up?
is there something different between an instance of Player and OfflinePlayer#getPlayer
no
strange
a Player will only exist if they are online
yeah thats fine
im using placeholderapi and I have private HashMap<Player, ProtectedRegion> regionMap;
but when I do regionMap.get(someOfflinePlayer.getPlayer()) its null
Player object can go stale, store against their UUID
pain
how is that pain lmao
that seemed like effort so I didnt
cause then I gotta compare a whole uuid instead of just a player object
waste of time smh smh
theres multiple ways to compare, one easy as .equals
it aint gonna be a waste of time when a player object goes stale lol
why would they go stale again
player logs off and back on
shouldnt that just be something I should handle
making something to handle that would be a lot more work than just using UUIDs
what effects could i add for drunk player? already have nausea
blindness, slowness
capture his textmessages and add gibberish to it
yeah well maybe ig im just scared of touching this class cause I broke it too many times and its the #1 source of lag on my server but ill give it a go
prob for you storing so much data
naaah
public void run() {
for(Player p : Bukkit.getOnlinePlayers()) {
if(CitizensAPI.getNPCRegistry().isNPC(p)) return;
Location location = p.getLocation();
ApplicableRegionSet set = WorldGuard.getInstance().getPlatform().getRegionContainer().get(new BukkitWorld(location.getWorld())).getApplicableRegions(BlockVector3.at(location.getX(),location.getY(),location.getZ()));
boolean isInGangRegion = false;
ProtectedRegion r = null;
for(ProtectedRegion applicableRegion : set) {
if(applicableRegion.getId().contains("block")) {
isInGangRegion = true;
r = applicableRegion;
}
}
if(lastSeen.get(p) != null && lastSeen.get(p) == r) { // Player already seen
return;
}
if(!isInGangRegion) { // if the player is not in a gang region and region exists within map
// Player has left a region
WGRGangRegionLeave event = new WGRGangRegionLeave(p, lastSeen.get(p));
Bukkit.getServer().getPluginManager().callEvent(event);
regionMap.remove(p);
lastSeen.remove(p);
} else {
// Player is in gang region
if(lastSeen.get(p) == null || lastSeen.get(p) != r) { // if last seen for player is empty, or last seen is already this region
lastSeen.put(p, r);
}
WGRGangRegionEnter event = new WGRGangRegionEnter(p, r);
Bukkit.getServer().getPluginManager().callEvent(event);
}
}
}```
prob cause of this
I run dat bad boi every 20 ticks
github down for anyone else?
Looks up to me, I can access it
page just laoded second i said something smh
took like 2 minutes for this repo to load lmfao
I don't think so, no
when I took that method that was giving null it created the DB correctly :v @noble lantern
Not per default, however. If you manage to deploy a java compiler to your smartphone then yes, ofc
ItemStack expFlask = new ItemStack(Material.GLASS_BOTTLE);
actually it is more pain i cant check if they're an npc apparently using uuids
expFlask? i just need the empty bottle, i already got it
thats just the var name
youd probably have to get a player object from the uuid
oh right I forgot thats a thing tx
error EnumConstantNotPresentException
Ok
I'm using LocalDateTime to calculate the time of a ban, is this a good way of doing it or is this reliant on the pc's time?
throw new OutOfMemoryError(new RuntimeException(new IllegalArgumentException(new NullPointerException())));
personally I just use long's for the start time and duration, and just check when the time has passed
Should work, however it is dependent on the pc's time
throw new OutOfMemoryError("Too big");
But any measures of time are, I think
Except you're pulling them from some kind of API.. but that'd be overkill
you can always use UTC time im sure
What do you mean?
When a punishment is issued I store the start system ms, and the duration in ms, and on the checks and what not I just check if that start time + the duration has passed
obviously its the system time, no real way to get away from that without like an api tho
So a banned player can just set the date to a month from now and get ubanned couldnt he?
Ohh it's the server's time?
ye
Unrelated to the client, wether he is the player banning or getting banned
nothing here is really related to the client in spigot lol
this ain't gta
Coding gta sounds horrible😳
wait - gta banns people based on their client?!
spoof me daddy?
nah but gta does a lot of things the client shouldn't be able to do
Ahh I see
Well it's developed by a small indie game company, you know
Give them some time
:>
yeah ofc ofc
basically, the client has control over what unlocks they have, over their current position and whenever they feel like teleporting away, what they can spawn, their luck in-game eg getting lucky drops, their minimum payout from heists, the cooldowns for anything and so on
also their XP and xp and money modifiers
idk the game is client-side with a side of server-side
why do they even need a server lol
well people wanna play online
it does tho
uh we were talking about gta
and im not sure about cod
I only know the client has the ability to control the position of vehicles it's entered and it can spam shop items without having purchased them
can we kick this guy? lol
i dont think you are understanding what having access means lol
age is irrelevant. Scope is everything
jail
Dream on
who
okay then, you omniscient bastard
I have yet to be kicked
the mods just like me too much ;)
A game that actually has this issue is payday 2 but that's cause you need to be able to have all your items offline
bruh this is like giving your enemy a gun without a bullet but you put the bullet in their pocket and you expect them not to use their bullet they clearly have access to it
The client has no control over how the server perceives their data unless they somehow can falsely authenticate it.
New World be like 
At least, that's how I interpreted what Zack said.
interpreter language
ew
Human brains are just <insert spoken language> interpreters
but the client is the one telling the server what data there is, so it clearly has access to it and to modify it
My brain is an English interpreter
everyone knows language should be compiled instead
my brain is a french, arabic, english interpreter
Although, it does have a W.I.P. Spanish branch, but I don't think that'll be finished anytime soon.
i have a wip japanese branch
.
thats not really having control then is it
imo if its not persistent then its not
its like using dev tools to edit an html site that's not having control over the site
How to set the color of the players name in tab and above the player?
Mainly because the skin information of the player is stored within a Mojang database, most likely.
You can retrieve the profile of a user through their auth token or UUID.
Actually I think username works too.
does anyone know where i went wrong?
This is why you can't fabricate capes btw.
There is no request you can make to add a new cape, and you can only select capes that your account "owns."
i need to draw a square in a map. I have the center of the square and its size. How could i draw it in the map?
How can I set a block type to a custom skull from the head db api?
rn it's doing steve heads
declaration: package: org.bukkit.block, interface: Skull
Oh wait you want the plugin api?
I'm using that one rn and it returns an itemstack
Use setBlockSkin
Oh lmao i love maven i need to compile a project for a friend and always have issues with the fucking maven repos. Sometimes doesnt fiend the local dependencies sometimes doesnt work in the way it doesnt index dependencies neither download them
Never had any issues with that
Yeah i think its because a problematic person
hahaa
Dont you think that?
Im going to invalidate cache again
SmithingRecipe smithingRecipe = new SmithingRecipe(NamespacedKey.minecraft(name), result, new RecipeChoice.MaterialChoice(baseTool), new RecipeChoice.ExactChoice(conversionKit));
Is there a way i can use my own item which is a diamond with metadata, but have the same pattern in the smithing table?
Ex : Pickaxe + Diamond w/ metadata = some item
Listen to the prepare event and do your metadata checks there
I dont know because im trying to use my local spigot (the one on .m2 folder) but i dont know if maven or intellij doesnt resolve it
ok thought so.. thanks
I think its maven but im not secure
Try running maven without Intellij
I cannot
I have tried many times running mvn commands without intellij and always get errors
Sounds like you haven't installed maven correctly
Or skipped dependencies in your pom
I only can run "mvn" commands if im using intellij console
If not its told me that mvn cmd doesnt exists
If you're on windows you need to specify the install location in the path environmental variable
I never defined a variable
🤡
I think its because i never installed maven just use the one that came with Intellij
Yeah you haven't told windows where maven is installed so it doesn't know
Intellij does though since it installed maven in it's own folder
So do this
LOl
Its too bug
It still doesnt find the fucked depend telling it using system path
I hate my life
I always have f*** issues
After you added the path open a new cmd window
You don't reload maven
Use mvn build to see if it compiles. Or mvn package if you want a jar
Yeah i know
But it cannot find the depend
So not find depend != not compile
For some reason its not finding spigot local depend when its inside the repo
It the 3rd time i check its inside
Is it possible to store objects in yaml files or do I have to encode them?
For example if I want to store my "kit" object, could I put it directly into an array of kits in my yaml file or would I have to encode it
you can store kits as long as they implement ConfigurationSerializable
Yeah its called ConfiguractionSeriable
Link to a tutorial?
Thanks 🙂
Configuration seriable allows you to save an object directly into yaml
Would it work with your yaml library?
That's what I still use
Yeah no matter, my "library" uses default spigot configuration
awesome, thanks
Look dm then
It can't compile without the depend
Is there any alternative for PlayerCommandSendEvent in lower versions?
You can probably use the preprocess event
It's not the same, PlayerCommandSendEvent is for sending the list of available commands to the player
Ah okay
I think its related to tab complete
Then you might have to use Protocollib
Yeah
Alr thx!
Your welcome, have a nice day or night
Lmao its amazing i have reindexed the full local repo and maven still not resolving any local depend
😮💨
I want to override the default world generator and tell the server where biomes are, but not generate the chunks myself. I tried a biomeprovider, which works 90% of the time, but stuff still generates where it isnt supposed to. Is there something I am missing besides a biome provider?
how can i detect a player consistenly holding left click?
im open to nms methods
So uh... I'm trying to see if the player is standing on a path block... issue is if I check the block at the player's location, y - 1, it says path blocks are 1 full block lower than the surrounding blocks
grass path is 15 pixels high so you're in y 86
round up the y coordinate
help pls
also, should I be checking for location or block location?
draw(64 - squareRadius, 64 - squareRadius)
try getting y-0.5
should help with slabs and such
yes but i would like to draw it based in a location
ehhhh
How do I cancel the spawning portal event when I portal the End Dragon?
I tried that and it didn't work:
On Main:
Bukkit.getPluginManager().registerEvents(new DragonEntityListener(), this);```
On DragonEntityListener:
```java
@EventHandler
public void PortalCreateEvent(PortalCreateEvent event) {
event.setCancelled(true);
}```
Hey so I was just wondering if making a variable static and then doing (class).(variable) is a good idea to get variables from other classes
well is there any other way?
access it through that class's object, obviously in some cases its not possible and static is one way to do that, there is also DI
?di
Guide to dependency injection: https://www.spigotmc.org/wiki/using-dependency-injection/
hmm ok
but sense the plugin is simple and if the first method works I will just use static abuse
because I will not be adding stuff
the chance of actually having an issue from static abuse is low either way
ok
also (I am very new pls do not judge my lack of knowledge) Do I have to put on enable and on disable in other classes than main?
Can I ask for help with the luckperms api?
No
help pls
Spigot comes with a MySQL java connector right? I'm using the following (below) in my pom.xml but getting NoClassDefFoundError: com/mysql/jdbc/jdbc2/optional/MysqlDataSource
.
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.14</version>
<scope>provided</scope>
</dependency>
Nah
How can I get a Location object from a ProtocolLib packet?
a) try removing it and using it
b) switch the scope to compile and make sure u have shade plugin
Black magic
LMBishop if you aren't here to help gtfo
Depends on the packet
It's often BlockPosition
understandable, have a great day
they have documentation on their github
Crying rn
but whats up
illusion more like allusion
illusion more like dellusion
go to bed taah
I know but the docs dont answer the question I have
What is your question
Right, but using compile makes my jar go from 300 KB to 1.2 MB :/
Also when removing the dependency from Maven altogether, it says:
package com.mysql.jdbc.jdbc2.optional does not exist
Does this mean the version of MySQL that I'm using in my code is too new for what's included in Spigot?
I'd recommend contacting LuckPerms, they would be able to give you greater insight on their documentation/API
it means that you're fixing the missing package by including it on your code
spigot has a very outdated mysql driver which you can use
or you can just use your updated one but you have to include it yourself
What does luckPerms need to be defined as, since where ever I put it it doesnt know what it is
Check that out, should answer your question
It's the plugin's instance
you can just call LuckPermsProvider.get() for that
If my jar goes from 300 KB to 1.2 MB because it's shading MySQL, does that slow down anything at all in my plugin?
no
thanks you!
Ok thanks
Is there any alternative you think to making my jar so bulky? I guess my only issue is that I need to use MysqlDataSource class which isn't available on older versions
auto-downloaders or something
or just don't use mysqldatasource
you dont need to shade sql
its provided by spigot
the version he wants to use contains features that spigot doesn't include
just dont use it?
¯_(ツ)_/¯
can i make my plugin.yml version the same as in build.gradle?
Nah
my updater doesnt work ```java
if (!configFile.getString("config-version").equals(pdf.getVersion())) {
Bukkit.getLogger().warning("Config outdated. Updating.");
configFile.getBoolean("back-enabled", true);
configFile.getBoolean("kickall-exempt-enabled", true);
configFile.getString("messages.permission-message", "You don't have permission to use this!");
configFile.getString("messages.kickall-message", "Kickall command was used!");
configFile.set("config-version", pdf.getVersion());
configFile.options().copyDefaults();
saveConfig();
configFile = YamlConfiguration.loadConfiguration(file);
}```
i deleted the kickall message from the config and restarted the server, but it didnt get added
make it provided then add it to library loader
that way it wont take up increase ur jar size and the server will automatically download and load the dependency
assuming its on maven central,, pretty sure it should be
to add to the library loader i think u add "libraries:" to your plugin.yml
then hit enter, then type
- "mysql:mysql-connector-java:5.1.14"
does anyone know of a guide to forking spigot? I want to change some of the methods slightly, add new ones etc to craftbukkit, spigot and bukkit classes but I can't figure it out (I don't intend to share it anywhere, it'd stay private)
i would assume u just edit the files given when running buildtools, else check out paper's paperweight repository, forgot which module, which makes it easier to make forks
I ran buildtools and opened the entire contents in intellij which didn't work because there were class clashes, so I opened Spigot in intellij and it's giving me compilation errors (System cannot be resolved?)
help why does my config updater not work
wait fixed it
does anyone have a working example of how to implement PrepareSmithingEvent?
I am setting the result, but i can't take it out.
is it the SmithItemEvent?
how can i update my config
like?
like update the existing one based off the one in the jar, keeping custom values
saveDefaultConfig
didnt work
you dont want that
saveDefaultConfig is a dumb copy
options().copyDefaults(true); saveConfig() is what you want
thought they were the same thing
saveDefaultConfig should probably be deprecated now that the API has comment support
might have to wait until 1.19 to update all of the libraries tho
would be weird to have such changes in a minor version increment
doesnt work either
Only thing that bothers me about copyDefaults() & saveConfig() is the fact that it removes all whitespace
I know, very minor thing that honestly doesn't matter, but it's literally the reason I still use saveDefaultConfig() lol
how can I get the killer Entity of PlayerDeathEvent?
player.getKiller() is null unless the killer is a player
player.getLastDamageCause.getEntity strangely always returns the player himself
It is indeed quite strange, I might be wrong but I don't think you can do that.
However there is a workaround, you can listen to EntityDamageByEntityEvent
Why does my packets not work? I have build tools installed|
https://cdn.discordapp.com/attachments/741875845089722499/964365543333318657/unknown.png
https://cdn.discordapp.com/attachments/741875845089722499/964365543635316786/unknown.png
https://cdn.discordapp.com/attachments/741875845089722499/964365543924719617/unknown.png
private int List<Integer>percentages = 0;
private List<String> commands = new ArrayList<>();
public BlockProperties(List<Integer>percentages, List<String> commands) {
this.percentage = percentages;
this.commands = commands;
}```
why is this giving error
Java specifically
ok, well it says at the top, Serious Spigot and BungeeCord programming/development help | *Ask other questions here*. ok ignore that comment... 😊
https://hastebin.de/uwamicahev.md
My code:
for (String s : kits) {
byte[] serializedKit = Base64.getDecoder().decode(s);
try {
ByteArrayInputStream in = new ByteArrayInputStream(serializedKit);
BukkitObjectInputStream is = new BukkitObjectInputStream(in);
Kit k = (Kit) is.readObject();
ItemStack i = new ItemStack(k.getIconMaterial(), 1);
ItemMeta m = i.getItemMeta();
m.setDisplayName(format(k.getDisplayName()));
i.setItemMeta(m);
inv.addItem(i);
} catch (IOException | ClassNotFoundException ex) {
ex.printStackTrace();
}
}
Anyone know why I'm getting this error?
Hi guys, could anyone help me? I would like to make a nether portal indestructible, but every time a block NATURALLY breaks next to the portal, it breaks. I've already tried to use BlockPhysicsEvent, it fires correctly, but even canceling the event, the portal keeps breaking.
Do you care about efficiency?
Well, the portal is massive, it takes up thousands of blocks, my fear is loss of performance
Is it at a spawn or something?
Basically it's a giant portal barrier and it's in the common world, survival
I don't really get how a block breaking naturally next to a portal would break it
maybe I'm missing something
can you give me an example?
If there is a leaves or plant that naturally breaks next to the portal, it will break.
Why would that break a portal, it would not normally happen in vanilla minecraft?
Have you looked into it being caused by a plugin you're using?
For example, as the portal is extremely large, it passes through several trees, when passing through them the leaves start to disappear naturally and with that it leads to the portal breaking. Another example, if a player breaks a tree that is connected to the portal, the leaves will start to break as well. This also occurs if an animal interacts with a block connected to the portal.
You could clear all the blocks around the portal
When you initially load it in
It could be something to do with the portals hitbox
I believe this is the best option at the moment, thank you ❤️
Is it more efficient to use try/catch or use one or more if statement to prevent errors from occurring in the first place?
Ideally if you can, you'd like to avoid errors being thrown in the first place
Although sometimes that's not possible
Any libraries for 1.18.2 that load schematics without WorldEdit?
Been looking all day through loads but they seem a bit outdated.
Why not use WorldEdit?
Creating my own manipulation system for things and WorldEdit is pretty much useless.
Schematics are not officially supported by mojang, if you want to use structures which are this resource could help:
https://www.spigotmc.org/threads/structure-util-nms-schematics.199250/
Yeah so is like 99% of what we do on Spigot lol
Not really
But I prefer schematics, I don't think I can make a 300x250x300 structure if I recall.
They all use stuff inside of actual minecraft.
Get creative, use multiple ;)
Not a chance
Alright make your own schematic implementation then
Am working on it, but I cannot figure out how to load a .schem file lol
And fetch the NBTs for entities, blocks, etc.
You have to creates you own parser for those files.
Yeah obviously, but not sure about how to do so.
If your lucky the files are in plaintext, if your not you need to look at the world edit source code and revere engineer it.
If they are in plaintext you should be able to use a bunch of regex to pull the values you want.
Keep in mind they also may be base64 encoded plaintext or something similar, so if you open them in your text editor and see a bunch of non-unicode charechters I would try to run it through a base64 decoder.
It's probably easier to build a system for fragmenting and re-combining structure files.
If you know python analyzing this code may help to give you a better idea of how .schem files work:
https://github.com/FolfyBlue/Schem-File-to-Structure-Block-NBT-Format/blob/main/main.py
O lawd
https://github.com/SpongePowered/Schematic-Specification/tree/master/versions
As others have mention the spec is documented
Python here we go
Choose your version and start coding :)
That's nice!
Yeah reading into that right now, let's see how it goes :> :>
the schematic format is actually documented on the minecraft wiki if I recall
world edit is open source so you can see how they do it
also if you need a lib to use NBT without making your own or relying on NMS there is https://github.com/frostalf/JNBT
world edit also uses JNBT but their own modified version
basically the schematic format uses similar format to what would get saved in chunks
so as long as you know how that works, you know how schematics work 🙂
frostalf goated
Well i saw it on intellij but that's all
Does using multiple listener classes for different events instead of one listener class with every event have an impact on performance?
If not, which one is considered to be better practice?
not sure what performance impact you would be referring to
its like asking will having multiple classes in a project cause performance problems
or will just having a single large one be better
you implement/parse for what those mean
my answer hasn't changed
you can use command preprocess event
to parse commands from almost anything
how you choose to parse what those placeholders mean, is up to you. it is similar to how regex works
except we are just only looking for very specific identifiers so you can swap that out with valid values
ServerCommandEvent triggers constantly
nvm it was a cmd block
seems like it triggers for commands from minecraft
there is ServerCommandEvent
yeah
normally shouldn't use it but I don't see anything better
and then you can check if sender is BlockCommandSender
it triggers only for commands registered by minecraft
just tested
kinda dumb
right now I am checking if player if pressing a button and if in a radius of 2-3 there is a commandbloc
but I think the better way to go is to just make a special checkpoint system based on buttons on the map
rather than pretty much make what mojang/spigot should have made
I could have sworn there used to be a commandblock event
but I don't see it in the latest javadocs so not sure how you are supposed to check for commands coming from such things
in 1.8 commandblocks used to work as they should
replacing the placeholders in ANY commands
1.8 also doesn't have brigadier either
1.8 is also like a horse with a limp
how do I make that a crop grows at it's max?
I am using blockData.setAge(7)
but it doesn't make a change
it's still age 1
Is there any way I can make an implementation of a bukkit runnable which will call a function when it finishes?
I was thinking I could override the cancel method, but I don't think that's called when it finishes..?
are you saying about repeating task?
yeah
I actually wait nvm
they do run until cancelled
so yeah I can just override cancel method
is there a way to remove the default 'attack_damage' or 'armor' from an item, with NMS if not with the API
it seems, when I add an attribute of 0.5 to a normal netherite sword, the final damage comes out as 3.5
this is less than a normal netherite sword
but I want the damage to just be 0.5
anyone know where the rest is coming from?
I don't have any strenght or other attributes on there
cancel the EntityTargetEvent
wait does the player itself maybe add 3, because punch damage is 3
so weapon damage + 3 always? whatt
?paste
what
I've been trying to calculate the time for players to be banned for hours and I can't managed to do it
This is my code:
https://paste.md-5.net/egenohitem.cs
Any idea what's wrong with what I'm doing?
hello, can someone help me?
because i tried to make that if i get wooden pickaxe from "PrepareItemCraftEvent" it makes it into a enchanted diamond pickaxe
i will paste the code
Events need to be in a class the implements listener and have the @EventHandler annotation above them
its in the java plugin class
babymode lol
yeah
Yeah, you already have 2 classes that have listeners in them, PlayerJoinedListener() and BabyModeListener()
You need a class like this to handle events
baby mode listener is like stuff that explosion doesnt attack the player and it doesnt do it too
Then do you want to put it in a seperate class?
So you will need to create a class that implements listener and put the event there
why do you have a listener without @EventHandler annotation in your main class?
No, you can have many
i tried to do that but it doesnt work
That's because your class doesn't implement listener
you didnt register it either
why are you parsing strings like "hour(s)" 🤔 is that user input ? And if so, what user writes out "hour(s)" to ban someone
It's from a preset I have for bans
The player chooses a preset and I get the time from there
how didnt i register it?
also will it work?
it implements listener
I think I managed to get it to work but now I have a weird problem
Whenever the player isn't banned and he is trying to rejoin I get
java.lang.NullPointerException: Cannot invoke "net.minecraft.server.players.GameProfileBanEntry.f()" because the return value of "net.minecraft.server.players.GameProfileBanList.b(Object)" is null
I mean after he is unbanned
Yeah, but I need the plugin to also work at 1.8
can someone help me?
How are you enforcing the ban ?
Yeah, as long as you implement listener at the top
Than yes it should work
I add the player to the ban list
plugin.getServer().getBanList(banType).addBan(target, reason, date, banning.getName());
can you provide the entire exception
Sure
[WARNING] Failed to handle packet for
java.lang.NullPointerException: Cannot invoke "net.minecraft.server.players.GameProfileBanEntry.f()" because the return value of "net.minecraft.server.players.GameProfileBanList.b(Object)" is null
at net.minecraft.server.players.PlayerList.canPlayerLogin(PlayerList.java:586) ~[spigot-1.18.2-R0.1-SNAPSHOT.jar:3477-Spigot-ffceeae-a459f4d]
at net.minecraft.server.network.LoginListener.d(LoginListener.java:156) ~[spigot-1.18.2-R0.1-SNAPSHOT.jar:3477-Spigot-ffceeae-a459f4d]
at net.minecraft.server.network.LoginListener.c(LoginListener.java:74) ~[spigot-1.18.2-R0.1-SNAPSHOT.jar:3477-Spigot-ffceeae-a459f4d]
at net.minecraft.network.NetworkManager.a(NetworkManager.java:258) ~[spigot-1.18.2-R0.1-SNAPSHOT.jar:3477-Spigot-ffceeae-a459f4d]
at net.minecraft.server.network.ServerConnection.c(ServerConnection.java:172) ~[spigot-1.18.2-R0.1-SNAPSHOT.jar:3477-Spigot-ffceeae-a459f4d]
at net.minecraft.server.MinecraftServer.b(MinecraftServer.java:1352) ~[spigot-1.18.2-R0.1-SNAPSHOT.jar:3477-Spigot-ffceeae-a459f4d]
at net.minecraft.server.dedicated.DedicatedServer.b(DedicatedServer.java:429) ~[spigot-1.18.2-R0.1-SNAPSHOT.jar:3477-Spigot-ffceeae-a459f4d]
at net.minecraft.server.MinecraftServer.a(MinecraftServer.java:1237) ~[spigot-1.18.2-R0.1-SNAPSHOT.jar:3477-Spigot-ffceeae-a459f4d]
at net.minecraft.server.MinecraftServer.w(MinecraftServer.java:1047) ~[spigot-1.18.2-R0.1-SNAPSHOT.jar:3477-Spigot-ffceeae-a459f4d]
at net.minecraft.server.MinecraftServer.lambda$0(MinecraftServer.java:304) ~[spigot-1.18.2-R0.1-SNAPSHOT.jar:3477-Spigot-ffceeae-a459f4d]
at java.lang.Thread.run(Thread.java:833) [?:?]
You should probably hide that ip address
this is most likely you don't have a null check somewhere
and you assuming that they exist in the banlist
Oh crap you are right😅
ip addresses are not private
True but man's doxxing himself or someone on his server
Likely himself
and their ISP will give them a new ip if there is issues
Yeah, the thing is where do I check
standard procedure
no they haven't
ip addresses don't contain anyones address and the closest you get is the nearest major city
when I was living in Cali, my ISP may have been down the road but if you ever queried where my IP address belongs to
the place it would show is some 300 miles away 😛

idk? don't know what your code looks like
if I had to guess its going to be in one of the onjoin events where you just assume they should be in the banlist and then attempt to remove them
when they are not in there
I'm not removing them myself
I leave it to the server, it prevents them from joining because of the banlist
The banlist isn't something I created
then you have some plugin doing something that it isn't supposed to
just note this is the development channel and not the #help-server so if you are not making custom plugins or whatever and this is something being thrown
then what I said applies
they parse some user input, issue a ban
Well, there is no plugin execution logic in the stacktrace. Unless a plugin injected itself prior and mutated the ban list entry
to cause the NPE
unless they were doing something with packets
as it says it failed to handle the packet
no
it failed to handle the packet because the server ran into a NPE
while processing the userban list
it is invalid state or a spigot bug
the packet is the player login packet
the server should have checks in place to prevent this NPE
not if it appears correct
no matter what data is throw at it
can I check how many miliseconds/ticks ¿/any kinf of time are left in a runTaskLater?
yes, the server should be able to handle malformatted packets gracefully
i tried to check if my plugin works, it supposed to give me a enchanted diamond pickaxe when crafted a wooden pickaxe, but it keep giving me the normal tool (the wooden pickaxe that i crafted)
No
alright then
I shall start spamming your server with malformatted packets and blow up your log
There is some situations where not handling is the best approach
yes not handeling is graceful. you can just throw it out
running into an exception is not
no it isn't
Can I get the time left of a runTaskLater() ?
If the login packet is malformatted, the server should prevent the player from joining, discarding their packet
I didn't say malformed
you can have a packet that is appropriately formatted just invalid data
because it was again mangled
if everything looks correct how is the server supposed to know 🙂
it can't until it tries to do something with the data
but that is exactly where it fails
alright well obviously you don't understand networking well enough to understand
:kekw:
the server is not doing a null check that it should do here
that is all that it is
or its local state is fucked
I don't think it is the server that is the issue, banlist for the server has existed since forever, its not like it magically goes away on that feature
and I don't recall spigot touching it at any point recently
so, either it is a plugin or they have mangled packets which again a plugin can cause
no, it is probably just bad state
can someone help me?
the only way the state can be bad is if they deleted the file while the server is running
like
feel free my dude
it is just bad server code
but if you want to jerk yourself off to your networking prowess, you do you
Does anyone know how to use Firebase in a spigot plugin?
yes I will
..
is there a way to set multiple blocks at once in code? like structure blocks but in code
firebase has a java sdk doesn't it ?
lol 😂
didn't realize that Mojang natively added tempbans so it explains why the server code is messed up
anytime mojang touches something they screw something up
alright well obviously you don't understand networking servers well enough to understand
xd
that has nothing to do with networking 🙂
Networking is a whole different ball game that most here will never get to really understand or experience
Well if a network god like yourself cannot see that from the stacktrace, it cannot be that hard of a topic can it
feel free to try to school me on networking
but unfortunately I doubt you will get to mess with satellites anytime soon
but again feel free to do so 🙂
i will read and try if i cant can you help me
how do i only check for xyz movement in PlayerMoveEvent? i still want people to be able to look around
but this doesnt seem to work.
if (config.getString("players.minecraftids." + player.getUniqueId()) == null) {
if (event.getFrom().getX() == event.getTo().getX() && event.getFrom().getY() == event.getTo().getY() && event.getFrom().getZ() == event.getTo().getZ()) {
event.setCancelled(true);
player.sendMessage("Please link an account first.");
}
} else if (!config.getBoolean("players.minecraftids." + player.getUniqueId() + ".verified")) {
if (event.getFrom().getX() == event.getTo().getX() && event.getFrom().getY() == event.getTo().getY() && event.getFrom().getZ() == event.getTo().getZ()) {
event.setCancelled(true);
player.sendMessage("You have to verify yourself first.");
}
}
anyway tho, if you are down for it, lets drop it 😅 glad we found the issue, I am sure your work on satellites is pretty sick and you for sure have a load of network experience. It wasn't applicable here, so no need for us to spam a channel and ruin a usually good relationship 🙂
doubt it, most people don't get to mess with satellites same as most don't get to mess with and learn networking on a deeper level. If that was not true there wouldn't be a demand for either of those things
when tf is PrepareItemCraftEvent called
That should be called when they put the items in for the recipe and shows the result
if I am not mistaken
shows the result but haven't taken it out
basically part of the slot changed logic yea
it doesnt seem like its calling it
or i registered my listener wrong
oh wait
used the wrong @EventHandler i think
bruh
😅
done that one before
you're checking for the opposite of what you want
happened 3 times now
where I used Java imports instead of Bukkit ones
used to happen often when messing with Vectors
htank you.... im kinda stupid
yeah
or maybe the bukkit imports instead of the bukkit imports, looking at you block data
WebSocket.Listener
gets me like 30% of the time
lmao
and then for event
I once accidentally imported JWT events
always fun to have that stuff happen
and then to run your code wondering why its spewing some nonsense
yeah
i made my own system
but a few of the names are the same
including @EventHandler
If I may ask, what was used in 1.12.2 plugins which can have the same effect as the more modern 1.14 implementation of the PersistentDataContainer ?
Maybe changing the NBT data manually ?
Pretty much
NBTAPI was pretty much the go to if you don't want to directly mess with internals
Isnt there a metadata or sth
Sounds useless
you basically had to track your own custom data instead of being able to save it as part of the world files
Ok thx, I just wanted to know before I endure hours of learning something new and it comes out there would have been an easier way
well metadata was just your fancy everyday map
Or maybe it'll be quick, who knows XD
NBT API isn't too difficult 👍
the only problem there was in allowing people just access to store whatever in regards to NBT is people are too lazy to clear their custom stuff
how can I cancel a BukkitRunnable?
declaration: package: org.bukkit.scheduler, class: BukkitRunnable
yeah
I've cheked that
but I am using a repeating task that idk how to cancel
for using cancel I need to use new BukkitRunnable() {
}. <- here I need to ad repeating task but it's not a thing
?scheduler
runTaskTimer
?schedulerprogramming
?scheduling
but that’s it
EY
lol
need to keep a list of these commands
?help
selfrole Add or remove a selfrole from yourself.
cleanup Base command for deleting messages.
embedset Commands for toggling embeds on or off.
info Shows info about CafeBabe.
licenseinfo Get info about Red's licenses.
mydata Commands which interact with the data CafeBabe has about...
set Commands for changing CafeBabe's settings.
uptime Shows CafeBabe's uptime.
findcog Find which cog a command comes from.
names Show previous names and nicknames of a member.
userinfo Show information about a member.
listcases List cases for the specified member.
reason Specify a reason for a modlog case.
permissions Command permission management tools.
oh that is useless
yeah
There will be an id assigned to it, keep track of that
ok
That is, if you run it via calling a scheduler
Preferably you just keep track of the BukkitTask the scheduler returns you
instead of an int
makes your life a lot easier
also, you can cancel the task from inside the task as well
just depends how/when you want it to cancel
not sure why you would want to do that
in essence you can change the players name but like only for what is displayed and not what the server tracks
most people who want this is because of offline mode servers, if that is the case we don't support such things here 🙂
via phishing yeah
a website could create a login that looks exactly like discords and trick you
but no website can just magically steal your stuff to my knowledge
anything
Well it can with roblox
Theyre store tokens and stuff in cookies afaik in roblox
Nah shouldn't be possible as tokens are stored per URL and the website shouldnt be able to access cookies from other websites
must be some flaw roblox has
you can if the cookie isn't encrypted
so as long as the site that created the cookie uses encrypted cookies then no it won't be accessible
well im sure discord would do that (hopefully)
not sure, but hopefully it does
discord isn't exactly known for their security though
yeah but tbf encrypting a cookie is pretty basic
well
they might use JWT tbh
if so thats fine
yes nowadays encrypting cookies is basic
imma check brb
and a built in feature easily usable
cant really tell if its an encrypted jwt or not but it looks encrypted
cookie is seperated by a - though for one of them
which is odd, as thats not a JWT thing or any encryption method i know
How do I check if an offline player exists?
Typically when i deal with tokens i find it best to re-encrypt the 3 strings in this seperating by ., then slap it back together and then encrypt the entire string over again with a different encryption key than the other 3 used
hasPlayedBefore()
Thanks!
u mean exists in the server?
or has ever existed in the server?
or exists as a minecraft player but not necessarily in the server
1 or 2 or 3
Exists as a minecraft player
But on the server works as well
check if the offline player equals null i guess
you could just check the ban list instead
OfflinePlayer requests mojang's api iirc
How to remove a bowl after a player has eaten a soup
Yeah but I did my own banList because the normal one didn't work for some reason
ive used https://hub.spigotmc.org/javadocs/spigot/org/bukkit/BanList.html
many times and never had issues
declaration: package: org.bukkit, interface: BanList
the issue is a temporary ban
do note if you ban a player with this you need to kick them as well
How to remove a bowl after a player has eaten a soup
either switch to paper or create your own ban logic
This happened when I tried
https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/player/PlayerItemConsumeEvent.html
check if eaten item was soup, remove one bowl from players inventory
@noble lantern it is for a kitpvp plugin. So idk if consumeitemevent works because the soup regen health
so your cancelling that event and instantly applying the soup benifits then
just remove the bowl when you apply the soup effects then
or
remove 1 from the stack as a whole
why does the result item flash for a second when im setting it to null in the event
does the client do recipe matching too?
I have a HashMap<Material, Int> called gearMap, basically I set all the armor types such as leather, chainmail, gold and so on to numbers to denote their levels. So all leather armor would be - 1, all chainmail would be 2... The way I'm doing this is by
private val gearMap = HashMap<Material, Int>(
Material.LEATHER_HELMET, 1,
Material.LEATHER_CHESTPLATE, 1,
Material.LEATHER_LEGGINGS, 1,
Material.LEATHER_BOOTS, 1,
Material.CHAINMAIL_HELMET, 2,
Material.CHAINMAIL_CHESTPLATE, 2,
Material.CHAINMAIL_LEGGINGS, 2,
Material.CHAINMAIL_BOOTS, 2,
Material.GOLDEN_HELMET, 2,
Material.GOLDEN_CHESTPLATE, 2,
Material.GOLDEN_LEGGINGS, 2,
Material.GOLDEN_BOOTS, 2,
Material.IRON_HELMET, 3,
Material.IRON_CHESTPLATE, 3,
Material.IRON_LEGGINGS, 3,
Material.IRON_BOOTS, 3,
Material.DIAMOND_HELMET, 4,
Material.DIAMOND_CHESTPLATE, 4,
Material.DIAMOND_LEGGINGS, 4,
Material.DIAMOND_BOOTS, 4,
)
This does not work but right now I'm just copy pasting the values for each armor type, is there a better way to do this?
I actually have a system for this kinda
you cant initialize a map like that
I know.
ohk
Are you using the recipe api
I was trying to organize the code but I haven't found a solution to initialize a map without having to
map[eee] = kk
And I'm not fond of pasting all that into my manager initializer
im just setting the result in the crafting inventory in PrepareItemCraftEvent
to null
Custom crafting right
You should really use the Shaped Recipe api and the un shaped recipe api
How can I set a block to a cobblestone-step?
generally I process this type of stuff instead of hardcoding
Its a lot cleaner and no events needed
its at the bottom
doesnt allow for custom items
like eith meta and nbt matching
private static final String armorKeywords = "HELMET CHESTPLATE LEGGINGS BOOTS";
private static final String rarities = "LEATHER CHAINMAIL GOLDEN IRON DIAMOND NETHERITE";
then just use indexof and whatev
PrepareItemCraftEvent
I havent used PrepareItemEvent but im going to assume its like PrepareAnvilEvent and in that case its gonna be very jittery
Hes using that but the result item flickers
it's not that jittery
yeah only materials
thankfully it is not
indexof?
Its likely a lot like PhysicsEvent too where it flickers for 10% of a tick
Oh thank god
split by space, 1st word is rarity 1, second word is rarity 2
etc
i have custom Ingredient interface which is matched against item stacks in a decision tree to match recipes
Ill have to use that event eventually for my plugin maybe ill take a look at it tmrw
As a rule of thumb, there is no API worse than PrepareAnvilEvent
well prepareitemcraftevent isnt great either for me
I had my fair level of fun with worlds
the name must be in lowercase, otherwise funky stuff happens
Orby when I take a look at this tmrw ill let you know and upload my src
whenever i click the result slot the original result shows but you cant take it
k
WorldSaveEvent fires before the file contents are written to, if you're using paper
lots of funny stuff
Its 5am for me rn or else ide take a crack
But at least there are alternatives
?
to the event
itemcraftprepare
prepareitmecafraft
prepareitemcraftevent
what then
yeah but thats the reason im using this stupid event in the first place
?jd if you really want the name, use javadocs but I think noone wants to know the correct one
for (rarity in rarities.split...) {
for (armorKey in armorKeywords.split...) {
gearMap[Material.nameOf("$rarity_$armorKey")] = iterator
}
}
it doesnt allow for custom items
Something like this?
Is there an equivalent statistic to Statistic.PLAY_ONE_MINUTE in 1.8?
Why not load those values from a yaml config
no jd
Orby try InventoryClickEvent maybe it won't be as jittery but may also not be the right event to use in most cases
Well, I personally use PrepareItemCraftEvent in one of my projects however I also add the recepie which I think is the critical point
wdym add the recipe
Ie like you do with ShapedRecipe
@EventHandler
public void onAttemptCrafting(PrepareItemCraftEvent evt) {
Recipe recepie = evt.getRecipe();
if (recepie == null) {
return;
}
ItemStack result = recepie.getResult();
if (result.getType() == Material.COMPASS) {
ItemMeta meta = result.getItemMeta();
PersistentDataType<Long, Long> longType = PersistentDataType.LONG;
PersistentDataType<Byte, Byte> byteType = PersistentDataType.BYTE;
if (byteType == null || longType == null) {
throw new NullPointerException();
}
if (!meta.getPersistentDataContainer().has(compassTier)) {
return;
}
meta.getPersistentDataContainer().set(compassShelfLife, longType, System.currentTimeMillis() + ThreadLocalRandom.current().nextLong(60_000L, 240_000L));
result.setItemMeta(meta);
evt.getInventory().setResult(result);
}
I use something like this in one of my plugins
oh
In your case you wouldn't need to add the recepie though
60_000 is valid wtf
but there may be multiple recipes with the same base materials
yeah
So is 6_0_5_88
I quit java
i always do 1_000_000
when converting ns to ms
how to use better bees
How would I initialize a map like this or something like this, I put this in my PlayerUtils class so it was more organized
private val gearMap = HashMap<Material, Int>(
Material.LEATHER_HELMET, 1,
Material.LEATHER_CHESTPLATE, 1,
Material.LEATHER_LEGGINGS, 1,
Material.LEATHER_BOOTS, 1,
Material.CHAINMAIL_HELMET, 2,
Material.CHAINMAIL_CHESTPLATE, 2,
Material.CHAINMAIL_LEGGINGS, 2,
Material.CHAINMAIL_BOOTS, 2,
Material.GOLDEN_HELMET, 2,
Material.GOLDEN_CHESTPLATE, 2,
Material.GOLDEN_LEGGINGS, 2,
Material.GOLDEN_BOOTS, 2,
Material.IRON_HELMET, 3,
Material.IRON_CHESTPLATE, 3,
Material.IRON_LEGGINGS, 3,
Material.IRON_BOOTS, 3,
Material.DIAMOND_HELMET, 4,
Material.DIAMOND_CHESTPLATE, 4,
Material.DIAMOND_LEGGINGS, 4,
Material.DIAMOND_BOOTS, 4,
)
We use it in AE but I always thought it was a hard coded enum....
plugin
It's the best feature to exist
getVersionNumber() > 1_16_4
Anyone?
how to use better bees plugin
Always thought it was an enum lmfaaao
Ask the developer directly
Load these from a yaml file
If the > wasn't there I would also think that it is an enum without syntax hilighting
is that possible
ye
what plugin? Also #help-server
that is valid java
where
fr
Yeah when I first say that I was mad confused cause my ide didn't import it on a new class lmao
ye
Saw*
epic
Also btw
Are you just trying to detect all armor in general
Way easier way to do this thats safe for all MC versions
A YAML?
you can just do this if you want what armor piece something is
Material#getType().name().endsWith("HELMET");
private val gearMap = new HashMap<Material, Int>() {{
Material.LEATHER_HELMET, 1,
Material.LEATHER_CHESTPLATE, 1,
Material.LEATHER_LEGGINGS, 1,
Material.LEATHER_BOOTS, 1,
Material.CHAINMAIL_HELMET, 2,
Material.CHAINMAIL_CHESTPLATE, 2,
Material.CHAINMAIL_LEGGINGS, 2,
Material.CHAINMAIL_BOOTS, 2,
Material.GOLDEN_HELMET, 2,
Material.GOLDEN_CHESTPLATE, 2,
Material.GOLDEN_LEGGINGS, 2,
Material.GOLDEN_BOOTS, 2,
Material.IRON_HELMET, 3,
Material.IRON_CHESTPLATE, 3,
Material.IRON_LEGGINGS, 3,
Material.IRON_BOOTS, 3,
Material.DIAMOND_HELMET, 4,
Material.DIAMOND_CHESTPLATE, 4,
Material.DIAMOND_LEGGINGS, 4,
Material.DIAMOND_BOOTS, 4,
}};
something like that
val >:(
Use EnumMap
Why not?
Or yknow the method that doesn't even need a map
Relying on the fact that material is an enum is a ticking time bomb
And is version safe
can't worry about what future versions may do
He didnt add netherite so I assume he's on a lower version
In the 1.18 (or 1.17?) release announcement it was declared that material will no longer be an enum in the future so don't start doing useless reliances
yooooo
Using the method I sent would make it work for netherite on higher version
it's old news my pal
didnt see it
Yet everyone seems to forget it
it makes sense for it to not be an enum but there will always be a mapping
It's not an Enum iirc
It's more of a registry than an enum (though you can make the argument that both are quite similar)
If it was an enum modding would be much harder
air has its own block class
Forge had (has) a hacky system for messing with enums
Though I think they removed it in 1.13+
Yeah, it is doable, just hacky and pretty hard to get working with other mods
Unless you are the person to hand-write ASM Transformers
Gnight yall
gn
i do not know why but my config updater will not work
Kotlin has a mapOf() function, my bad