#help-development
1 messages · Page 2248 of 1
was the bstats in teh jar actually relocated to teh correct pattern?
Can you pls tell me how to craft hearts @still tusk ?
how do I set a ban time
idk, I think you gotta ask mfnalex on how to craft hearts
i think they manually copied the bstats class
Please tell me
?ban
Syntax: ?ban <user> [days] [reason]
days is the amount of days of messages to cleanup on ban.
Examples:
?ban 428675506947227648 7 Continued to spam after told to stop.
This will ban the user with ID 428675506947227648 and it will delete 7 days worth of messages.?ban @Twentysix 7 Continued to spam after told to stop.
This will ban Twentysix and it will delete 7 days worth of messages.
A user ID should be provided if the user is not a member of this server.
If days is not a number, it's treated as the first word of the reason.
Minimum 0 days, maximum 7. If not specified, the defaultdays setting will be used instead.
^ syntax
I've seen the jar yesterday
ye true
but i'd shaded updater and check it on both .jars
so you manually included teh bstats class in your project?
yep
you can only set the ban time globally in the config option
well that explains why its there
okay im going to try it again
remove it from yoru shade patterns
Where is the config option
and maybe all will okay
yoru?
your
ah okay
no point in having it try to shade bstats if you manually added it
oh okay
it may also be why its not shading the rest
in the plugin's config file ?
Tbh I am completely lost
plugins/<pluginName>/config.yml
And copy and paste the template in there?
the file should already contain stuff
it is
then look for banTime
it says 0
Ik so what do I replace the zero with if I want to ban them for a day
the time in minutes
so 1440
@eternal night

so I changed the bantime to 1 so I can test if it unbans my alt but it didnt work
did you restart the server
@still tusk Date date = Date.from(Instant.now().plus(Duration.ofDays(5)));
for expires
they are not interested in coding
call it Ben
hmmm 🤔
i want to do smth else cuz im kinda stuck lol
stepsister vibes intensify
the Ben hammer
well ye i could use "the ban hammer has spoken" as default reason
ben the ban hammer
@eternal night
@still tusk
what
@still tusk
what
sup
hm is there any easier method for this? This is used to check for example if "sixty nine" or "sixtynine" or "sixty-nine" is the same as 69 https://paste.md-5.net/kaxavoxenu.cs
i dont need numbers above 100 because no one will write them out anyway
😳
lol my friend made this and my eyes are burning
unfriend your friend
⚠️ IT HAS LIGHT MODE CUZ I JUST RESET MY PC ⚠️
excuses
pls
How do I go about pregenerating a world??
Look at plugins like Chunky
item.addUnsafeEnchantment(Enchantment.DAMAGE_ALL, 10);```
im using this
but idk why it wouldnt work
its not adding the sharpness enchantment to the sword
i checked the docs and stuff, and found out that DAMAGE_ALL is for sharpness
why not just adding enchantment to the itemmeta?
are you setting the item meta of the item afterwards
might override your changes ^
tried, it doesnt have the addUnsafeEnchantment thing
is there an easy way to get the playerdata folder?
declaration: package: org.bukkit.inventory.meta, interface: ItemMeta
that
wouldnt let you set an enchantment
above its normal vanilla lvl
i wanna set it like sharpness 50
or something
it does
the boolean passed is literally there to ignore level restrictions
ignorelevel restriction
set that as true lmao
"hey should I ignore level restrictions ? NO" -> why does it not ignore level restrictions
people are idiots 🥺 🥺 😭
is there a method to get the playerdata folder?
but like i want the sharpness to be 50
or atleast 10
and then?
false makes no sense if you actively want to ignore level restrictions
any ideas?
ignore level or not ignore
check the docs lol
false means limit
true = ignore limits
nice xD
what i should to do? xD
?
btw is it like required for me to
change the plugin file (in the paper server)
each time i update it
the plugin jar yes
also im using maven
and when im like building the package
if there was a previous one in the target folder
it overrides it
it makes a new one called shader, i want it to make like a new one
is the shader like, the old one
or the new one
oh ok
ty btw, it works good now
also, i got a question is it possible to edit the enchantment name
What would be the appropriate way to get the workstation itemstack of a villager profession, and vice versa?
it shows like
how to fix that?
i cant send images lol rip
!verify
Usage: !verify <forums username>
hide the enchant using meta.addItemFlags and edit the lore yourself to display smth custom
that will hide all enchants anyway
aight
oh, so its not possible to just edit one
?
no unless you edit to lore to display those others too i guess
it might look different idk too long ago
Something failed to save
first off, thats purpur NMS not Spigot
okay, i need to replace it to spigot, but why its appeared
I mean you can use what you want but don't expect support here
?fork
SpigotMC maintains the Spigot server. If you are using a fork of Spigot (such as Paper, Airplane, Purpur, or other derivative works), you should seek support in the appropriate Discord servers.
oh k tq
Forks behave differently. We could be chasing our tails for hours trying to diagnose an issue that only happens on a specific fork.
Is it possible to get the DamageModifier from a strength potion effect ?
how can you get the playerdata folder File
Isn't powder snow a material?
I mean it is a bucket and it doesn't exist as a block
but im making a block blacklisting and i dont want players to get teleported in powder snow
aha @hasty wasp
Bukkit.getWorlds().get(0).getWorldFolder() + seperator + "playerdata"
thanks
I am trying to change the skin of a player, any ideas what I am doing wrong? (version 1.17.1)
final CraftPlayer craftPlayer = (CraftPlayer) player;
final GameProfile gameProfile = craftPlayer.getProfile();
final PropertyMap properties = gameProfile.getProperties();
final String name = profileCall.getValue().getProperty().getName();
final String value = profileCall.getValue().getProperty().getValue();
properties.removeAll(name);
properties.put(name, new Property(name, value));
Bukkit.getOnlinePlayers().forEach(it -> it.hidePlayer(this.plugin, player));
Bukkit.getOnlinePlayers().forEach(it -> it.showPlayer(this.plugin, player));
final String message = this.plugin.getConfig().getString("messages.skin_changed");
player.sendMessage(Objects.requireNonNull(message));
try to delay the hide->showing of the player. otherwise check your name value
didn't work out, changed all name parameters to "textures" and delayed the process by 10 ticks
looks like just hide and show the player again doesnt work anymore
you also have to kill him and reset his info (inventory f.e.) to update him
nah.. i found, that i have to provide the signature to change the skin
how would i call a cache that has a method #queryForRemoval which will remove the entry after x time?
Use a chaching library 👀
push any entity for removal to a queue
just needs teh entity and time
I may not be understanding your question
i think he means the name of the class
ye
we would need more context
otherwise you could just name it Cache with the given info
DelayedRemovalCache?
hmm maybe
i was looking at guavas CacheBuilder but that doesnt support removing after some specific time
WaitALittleBitBeforeRemovingCacheClass
make it a GC alike
so you have to beg the cache to remove it
maybe he will
maybe he will leak
and give him feelings
SensitiveDudeCache
thats kinda the spirit
SensitiveMoodyCache
it was due shaded jar(my plugin)
if(player.hasPermission("asciavdf.give"));{
ItemStack ascia = new ItemStack(Material.IRON_AXE);
ItemMeta ascianame = ascia.getItemMeta();
ascianame.setDisplayName("§cAscia VDF");
ascia.setItemMeta(ascianame);
ascia.addEnchantment(Enchantment.DURABILITY, 1);
player.getInventory().addItem(ascia);
player.sendMessage("§7[§cVDF CORE§7] §7Ascia givvata con successo!");
} else {
player.sendMessage("&7[&cVDF CORE&7] &7Non hai abbastanza permessi!");
}
gives me else in red, why?
does this looks like a good impl?
Hey guys quick question. I want to get the name of a player based on the uuid. I don't want to fetch from mojang api because of the latency and it's limitation. I know that I would need to implement something myself. Question:
did someone implement a plugin for that already which I can just depend on and use it inside mine?
u havent translated the else message
its & not §
you use § in one message and & in the other
someone has to show me that web lookup part cuz i digged thro the whole code and couldnt find any of that stuff
use ChatColor.translateAlternateColors('&', your message)
you shouldn’t use that
enum exists for a reason
only use that for like a config.yml
why not
But it's not a message problem, else is red, why
enum is long
that needs colors to get parsed
does jobs reborn works in 1.19?
enum is better practice
get rid of the ;
?learnjava
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.
anyone knows if that is already public implemented?
Bukkit.getOfflinePlayer(uuid) ?
Bukkit.getOfflinePlayer(UUID) doesn;t perform a Mojang query
then check if the player is online, then getPlayer()
lemme search thro the impl for the web lookup lol
If they have been on your server the name will be not null in the returned OfflinePlayer
Doesn't give the current name if it was changed since last login if I am not wrong
only use api if you need to get offline player based off or name
only one making a query is the getOfflinePlayer(String)
tested?
Correct, but it would be impossible to see a name change without querying Mojang
?stash
is this the impl?
yes
what do you expect? to get the latest name you gotta query. otherwise you will only receive what's granted by the file
?learnjava
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.
?jd-s
<scope>provided</scope>
don;t use exclusions unless you want to only exclude specific packages in a module
is craftbukkit thr spigot impl?
oh okay i gotta replace it to provided
for some reason this is not running which tells me that the entire PlayerInteractEvent is not running im not getting the debug message
you add provided to any dependencies you don;t want shaded
ye thanks!
i am left clicking and im not getting a error
yes
to abstract any nms interactions from the user
well, api
im looking for the DedicatedServer.java file but i can only find a patch file
Well yeah, cause you cant just host nms code
and i did register the events and added eventHandler
?paste the eventhandler
ah ok
no wonder, the if will always be false
since the action has to be RIGHT_CLICK_AIR
you are in the RIGHT_CLICK_AIR if
did you find it?
theres something u can do i think to like get the FULLY patched source but i forget which applyPatches u need to run @tardy delta
its in the readme of either CraftBukkit or Spigot
what you want to do is either jump out of the upper if or else it
got the decompiled stuff
does anyone have any idea how to use VanishNoPacket in a plugin? I'm having trouble using it in mine and I can't import any of its classes
maven
show us your pom.xml
How do I add if the player is wearing boots named "hello" text them?
add what?
i actually did not understand anything
ah its in https://hub.spigotmc.org/stash/projects/SPIGOT/repos/craftbukkit/browse/README.md if u want patched decompiled src @tardy delta
under making changes to minecraft
you have the getArmorContents in the PlayerInventory
?jd-s
ok
or
<dependency>
<groupId>org.kitteh</groupId>
<artifactId>vanish</artifactId>
<version>1.0</version>
<scope>system</scope>
<systemPath>${project.basedir}/libs/VanishNoPacket.jar</systemPath>
</dependency>
this is what i did
you can use the getItem(EquipamentSlot)
uhh i want to find the DedicatedServer#getProfileCache method
where is the repository
you probably want to use https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/Bukkit.html#getPlayerExact(java.lang.String)
i guess obfuscated cuz i cant find it in MinecraftServer anyways
oh my god nevermind
i forgot to refresh the maven thing
ok i will use that then, I was using a local jar before
i just found getProfileCache in net.minecraft.server.MinecraftServer hmm
uh idk if the fact that im in net.minecraft.server.v1_16_R3 makes a difference
hm
well this is what does the web request i guess
@buoyant viper what are you trying to do
trying to locate something for fourteen
i was just tryin to find the place where the web lookup for Bukkit.getOfflinePlayer happened lol
if im correctly interpreting this
Ye
imagine clearing the cache 🤡
ye what i was looking at
how can i use remapped in gradle
how to get the block type out of an blockbreak event?
you have getBlock method
isnt there a Block#getType?
and the Block class have a getType method
ah okee, yee already had .getBlock but getType was what i searched! thy ❤️
?paste
https://paste.md-5.net/agafipilof.xml why the hell does it refuse to work. plugin yml is on bottom
access denied it says
access denied
chmod your files
lol
chmod
don;t use plugman
i dont use plugman
chmod +x
also restart fixed it
then do a restart not a reload
.
i never had problems with plugman or reload
and plugins\MCBCL-1.0-SNAPSHOT (3).jar How many do you have in there?
i always use reload and i never got problems with it
until you do
one. i just compile on my mac and throw it on google drive, downlaod and put it in folder. inneficient ik, i just hate alt tabbing all the time
where is plugwoman? did she die or smth
hahaha jokes
never existed as we don;t know what a woman is
;
hmm facts
lots of judging
mac
M1 is kinda beastly tho
ye
those are 2 diff computers
one is my pc with the gpu, i play games there, work when im home...
mac when im not home
Anyone know what is the velocity of gravity for entities
velocity: moving
it increases all the time i think
gravity: falling
acceleration
you can do cool things with velocity
hello, is there a way to ban words in the chat, like some people are saying racist things and i dont want those words in the chat
well
player.setVelocity(new Vector(0, 50, 0));
🤡
🪞
You have tons of possibilities yes 🙂
is there a plugin for it?
good
a lot
does essentials have something against it?
Wrong channel, go to #help-server
#help-server is a better place
Anyone know if predicates work with custom nbt values? For example if I add "open":1 as an nbt to this item, will the model change?
{
"predicate": {
"custom_model_data": 539101
},
"model": "item/backpack_leather"
},
{
"predicate": {
"open": 1,
"custom_model_data": 539101
},
"model": "item/backpack_leather_open"
}
Hey what's a 1.19 alternative for actionbarapi which is on 1.16
how would i run maven project with multiple modules to compile into one jar
nop i guess
oh ok
I guess ill just change the model data then
@heavy marsh https://minecraft.fandom.com/wiki/Predicate
Predicates are data pack files, invoked with various means to check conditions within the world. They return a pass or fail result to the invoker, who will act differently based on this result.
This page describes how predicates are defined and invoked. Also described here is the JSON structure of a predicate condition, the primary JSON structur...
maybe jt is possible
idk, i did not read so much
?tryandsee lol
seems the only predicate values are: angle, blocking, broken, cast, cooldown, damage, damaged, lefthanded, pull, pulling, charged, firework, throwing, time, custom_model_data, level, filled, tooting
non of which let you query nbt
Spigot API broke a plugin = (
it so happens to be a discord bot...
calling
``getServer().getScheduler().cancelTasks(this);
throws errors now, was fine who knows how long
what errors
NoSuchMethodError
?paste it
i guess youre using a mismatched api and server version
It compiled fine...
doesnt mean anything
just so long as you don't turn it off mid use it's fine
it cancels all tasks for this, which is the plugin
then you are not passing it an instance of your plugin
its can't find a method for the value you are passing
read the error and it will tell you
I am, but this is not new code... All of a sudden spigots new API is doing something differently that I can't figure out
Paste the full stacktrace
[DiscordChatMerge] Disabling DiscordChatMerge v1.0.1
[09:58:58] [Server thread/ERROR]: Error occurred while disabling DiscordChatMerge v1.0.1 (Is it up to date?)
java.lang.NoSuchMethodError: 'void org.bukkit.scheduler.BukkitScheduler.cancelAllTasks()'
at discordChatMerge.Main.onDisable(Main.java:51) ~[?:?]
at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:266) ~[spigot-api-1.19-R0.1-SNAPSHOT.jar:?]
at org.bukkit.plugin.java.JavaPluginLoader.disablePlugin(JavaPluginLoader.java:367) ~[spigot-api-1.19-R0.1-SNAPSHOT.jar:?]
at org.bukkit.plugin.SimplePluginManager.disablePlugin(SimplePluginManager.java:500) ~[spigot-api-1.19-R0.1-SNAPSHOT.jar:?]
at org.bukkit.plugin.SimplePluginManager.disablePlugins(SimplePluginManager.java:492) ~[spigot-api-1.19-R0.1-SNAPSHOT.jar:?]
at org.bukkit.plugin.SimplePluginManager.clearPlugins(SimplePluginManager.java:543) ~[spigot-api-1.19-R0.1-SNAPSHOT.jar:?]
at org.bukkit.craftbukkit.v1_19_R1.CraftServer.reload(CraftServer.java:883) ~[spigot-1.19-R0.1-SNAPSHOT.jar:3528-Spigot-56be6a8-031eaad]
at org.bukkit.Bukkit.reload(Bukkit.java:801) ~[spigot-api-1.19-R0.1-SNAPSHOT.jar:?]
at org.bukkit.command.defaults.ReloadCommand.execute(ReloadCommand.java:27) ~[spigot-api-1.19-R0.1-SNAPSHOT.jar:?]
at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:149) ~[spigot-api-1.19-R0.1-SNAPSHOT.jar:?]
at org.bukkit.craftbukkit.v1_19_R1.CraftServer.dispatchCommand(CraftServer.java:821) ~[spigot-1.19-R0.1-SNAPSHOT.jar:3528-Spigot-56be6a8-031eaad]
not spam
Main.java:51
51 is line 4 on that
yeah, you can't use the scheduler in onDisable. it will cancel all tasks on its own
it needs to in the stop command
oh it worked for me
then cancel all tasks in the stop command and not in onDisable
thats the wrong type
should be looking at item predicates (https://minecraft.fandom.com/wiki/Model#Item_predicates)
it is an odd error though
been released since 2020 now in 1.19 something
I know you can;t use teh scheduler in onDisable but it gives you an actually helpful message
like 0 code cahnges since 2020 on it, now it's busted
java.lang.NoSuchMethodError: 'void org.bukkit.scheduler.BukkitScheduler.cancelAllTasks()'
how does this look?
https://paste.md-5.net/togicucifi.java
edited it
looks scary
no u
:c
im sowwy
i guess ill make a CachedRepository abstract class which already holds the cache inside
as probably all my stuff needs the DelayedRemovalCache::remove thing
the issue I see is the remove part
kinda yes
other than that, Ig it looks fine
There is no reference to org.bukkit.scheduler.BukkitScheduler.cancelAllTasks() anywhere in the scheduler code of Spigot. Its not being thrown by the cancelTasks(plugin) call
any idea on how to improve that?
Cross-world non-player entity teleportation
It looks bug prone
lets say someone within the span of that duration invokes remove again, or well adds a value for said key again
yeah just getting rid of that line fixed it up... Thanks guys
spigot seems to handle the rest
hmm ye right
my responsibility to not do that :/

adding the values which should be removed to a queue is a little bit overhead i'd say
thats a queue? 
idk lol i just mean a collection
so you are batch removing them? Not just as they come in?
when i call ::remove, im just querying a task to remove them after a given delay
maybe a bit overhead to make a new task each time
na
what am i doing wrong with this Smoker Recipe?
https://paste.md-5.net/powiyubova.cpp
This Furnace Recipe works.
https://paste.md-5.net/urixabucem.cpp
i guess ill just have to be consistent to not do weird stuff 🤔
mye
well I hate whenever u have to involve scheduling
it is always prone to insidious bugs
and then ofc Ig you could test around that
when he said remove after x time i thought of a selfclearing cache
but why do you want to delay the remove
^
for users that logout and relogin right after that
isnt the span of 1 sec a bit too low for that
wdym
also with the current code isnt it removed anyways
ah nvm i didnt saw the x.toSeconds
also this isnt really an "ask to remove", its more like a "i say remove but your ping is 1000"
wasnt your idea first to query the removal?
yeah, but you want it to stay if they log on back nor?
hmm ye that will put it back in and after the delay it will be removed anyways
right now its kinda useless, since you are just delaying the removal. its bug prone
havent thought about that lol
maybe keep track of the tasks that will remove it
and remove that task if they log back in
you could give your query a timestamp of like 5 mins in the future
once the timestamp isnt in the future anymore you can remove it
if the user log in back, you remove the query
so you dont have a timer for each
looks about right but for what the generics
you give your query a timestamp which represents when the query should be executed
so that for example when player X leaves his data lasts for 5 minutes. but if he connects back in time the data stays
how to catch an event, if an itemframe breakes? i thought it's EntityDeath, but thats just for living entitys...
so it knows what to remove?
but with that timestamp, i would still need the scheduler no?
yeah but just one which can be delayed up to 1-5 mins
for what if you already know that it will be a query and a timestamp
so just scheduler::runTaskTimer which peridically checks for the time of the queries and depending on that, removes it or not?
sounds about right
so i can use ::remove(query.key()) ?
or i could just use a runnable cuz that generics seems to not work with the record
check if the args length is 0 and do your stuff
cuz a record is a static typed class i guess
wut
wait im stupid
@hybrid spoke like this?
actually isBefore should be isAfter
wait no
so it will schedule a task which will check every 5 minutes if i can entries which should've been already removed
hello i need help with my code i become this error but i don't have a idea why i become this error (my english is not the yellow from the egg..)
code:
package de.maurice.mcp.teamspeak;
import com.github.theholywaffle.teamspeak3.TS3Api;
import com.github.theholywaffle.teamspeak3.TS3Config;
import com.github.theholywaffle.teamspeak3.TS3Query;
public class init {
public static void main (String[] args) {
final TS3Config config = new TS3Config();
config.setHost("82.165.107.47");
config.setEnableCommunicationsLogging(true);
final TS3Query query = new TS3Query(config);
query.connect();
final TS3Api api = query.getApi();
api.login("MCBOT", "xxxx");
api.selectVirtualServerById(2);
api.setNickname("MCP :: SERVERBOT");
api.sendChannelMessage("bot");
};
};
error:
Exception in thread "main" com.github.theholywaffle.teamspeak3.api.exception.TS3CommandFailedException: A "sendtextmessage" command returned with a server error.
>> insufficient client permissions (ID 2568), failed permission with ID 219
seems like after you log in, your bot does not have permission to "sendtextmessage"
yea but the bot have serveradmin rights so i think that he has the rights to make all 😄
hmm
I used that before for voice chat actually pretty cool
someone else wrote JNI wrappers for the SDK though, so it was very little work. Last I checked TS3 SDK was in C only
okay so it was a cache error i have reload vscode an so its work 😄
trying to compile 1.19 branch of fastlogin
anyone knows how do i fix this
duplicate entry: META-INF/services/fastlogin.slf4j.spi.SLF4JServiceProvider
Context?
Additional lines in the compile log would be nice, as well as how you compiled it
FileManager: https://paste.md-5.net/unehiriguw.cpp
ItemManager: https://paste.md-5.net/qefekahupo.cpp
Main class: https://paste.md-5.net/oyitirufut.java
PlayerJoinEvent: https://paste.md-5.net/ruqedogona.java
I'm trying to make a itemstack and setting data about it (displayname, lore material etc) into the customfile and getting the items on join. I know I'm doing something wrong but not what im doing wrong. Thanks in advance
thats the error that makes it fail
well we are going to have issues with that too if you don't tell us whats wrong
and i used clean install shade:shade
Well for starters
I assume that you just cloned a repo, what is the repo URL?
public static void setItem() {
FileManager.getCustomConfig().set("item.gadgetsmenu", gadgetsMenu);
}
Is this the right way to set loading items in onEnable after creatingcustomconfig?
How would I make the itemstack since all the data is supposed to be making iteself with customConfig.set
It does look cursed
that exact branch
Would need to look more closely to see if that is indeed the proper way of doing it
Maven is fireee
These devs seem to not know that that is not how to use SLF4J
yeah
it would be also nice
if he shared how to compile his project
also
i had to restart invalidate the cache clone rebuild
like 50x times
for the dependencies to wokr
maven is fun haha
Intellij is bad the amount of times you have to invalidate cache
Bruh had to do it 5 times using rust last night and didn't evne work ended up switching back to vsc for rust
i just hate maven
SLF4J is really nice
Best thing out there, but come on - at least you should know that it isn't meant to be shaded in your plugin
If you are lucky you can exclude any artifact in the org.slfj4 ground there: https://github.com/games647/FastLogin/blob/809-119-compatibility-1/bukkit/pom.xml#L157
However chances are that this will not work
It might, but I recommend to use the one that is maintained by mfnalex
I will just ask the dev I guess
I don't have any more brain power to deal with this
xd
I am trying to get a Sign instance from the block the player is at, and I was told to do it with the block state.
BlockState blockState = player.getEyeLocation().getBlock().getState();
Sign sign = (Sign) blockState;
But I am getting this error:
java.lang.ClassCastException: class org.bukkit.craftbukkit.v1_19_R1.block.CraftBlockState cannot be cast to class org.bukkit.block.Sign (org.bukkit.craftbukkit.v1_19_R1.block.CraftBlockState and org.bukkit.block.Sign are in unnamed module of loader java.net.URLClassLoader @759ebb3d)
What should I do?
Your block is just not a sign
Gotta some problems... The server says in Italic/LightGray "[Server: Showing new title for Player]", "[Server: Showing new subtitle for Player]" when trying to send a title. Can you help me?
Version: 1.16.5
Check if the block data is a sign
Or state can't remember
See what Sign.class extends
Block state
Any one can help with packet or item name
I would like to use item name message as second action bar
Is that to crazy idea
bump
why isnt this working?
class SomeClass<T> {
record Stuff(T t) {}
}```
the generic parameter in the record doesnt work
only seems to work when converting it to a non static class
How can I create fake players on tablist? I mean i know that should I send ClientboundPlayerInfoPacket, but when I send it on player join it doesn't work. <- Player can't join to the server.. Without any errors in console
[16:39:51 INFO]: ★ TheTuso joined the game
[16:39:51 INFO]: TheTuso[address] logged in with entity id 154 at ([world]24.829597197271955, 65.0, 1.865502375417641)
[16:39:51 INFO]: TheTuso lost connection: Disconnected
[16:39:51 INFO]: ★ TheTuso left the game```
Makes sense
records are static classes?
Send a few ticks later maybe
Most likely
stfu
why so angry o.o
cuz this way of doing it sucks
make a specific class if you want to return or hold multiple things
make a tuple yourself
the same thing, for test I send it 3 seconds later, and after that 3 seconds it disconnects the player
Code how I create packets and ServerPlayer```java
private @NotNull Collection<ServerPlayer> getFakePlayers(int amount, @NotNull Player receiver) {
ServerLevel serverLevel = ((CraftWorld) receiver.getWorld()).getHandle();
Collection<ServerPlayer> fakePlayers = new ArrayList<>();
for (int i = 0; i < amount; i++) {
fakePlayers.add(this.createCraftPlayer(serverLevel).getHandle());
}
return fakePlayers;
}
public @NotNull CraftPlayer createCraftPlayer(ServerLevel serverLevel) {
GameProfile gameProfile = new GameProfile(UUID.randomUUID(), " "); // 32 spaces
gameProfile.getProperties().put("textures", this.DEFAULT_SKIN);
ServerPlayer serverPlayer = new ServerPlayer(this.minecraftServer, serverLevel, gameProfile);
CraftPlayer craftPlayer = new CraftPlayer((CraftServer) Bukkit.getServer(), serverPlayer);
craftPlayer.setGameMode(GameMode.SPECTATOR);
return craftPlayer;
}
public ClientboundPlayerInfoPacket createPacket(Player receiver) {
return new ClientboundPlayerInfoPacket(ClientboundPlayerInfoPacket.Action.ADD_PLAYER, this.getFakePlayers(80, receiver));
}```
tf
Yeah, record types declared inside of a type are implicitly static
Did you know you can do this too?
public class Main {
public static void main(String[] args) {
record Example(String value) { }
Example first = new Example("Hello");
Example second = new Example("world");
}
}```
You can do it with classes. They're just implicitly static
I can't think of a reasonable situation to do it for a class, but doing it for a record sort of makes sense lol
I've had to use records only in a single method before
oh didnt know records could be generic
thats why its so fast to create a Tuple with records and generic
so i could do this hehe
How
god...
Why do you need that
if you got smth which is more complex then use a custom class
technically i could also do it with an iterator over the values
That's your opinion, I want to hear reasoning about why tuples are "against OOP rules"
wait let me find this one post from one of Javas creator
Records are called nominal tuples in the JEP that introduced them
love it
Why do you need that
im iterating over a map with holds queries to execute at a specific time
and in my current impl i need access to both the key and the value
Stream over the entry set
so Iterator<Map.Entry<K, RemoveQuery<K>>> ugh
Wait
streams are slow
👀
Iterating over all of them to check which ones should be executed and removed
Use a TreeMap or TreeSet
if you wanna see the whole thing here you go: https://paste.md-5.net/ameduzeyib.cpp
ignore the two for loops, just testing smth
Then you can just directly retrieve all the ones that are due to be executed
lemme look what a treemap is
isnt that a map which takes a comparator to order the elements?
What would be a decent-ish way to generate custom structures? They aren't too large but I am not entirely sure if Spigot/Bukkit has a built in way of doing this. I'd like to not rely on WorldEdit schematics
sorry, its not against OOP rules, its against OOP design goals:
https://stackoverflow.com/questions/24328679/does-java-se-8-have-pairs-or-tuples/24336841#24336841
Is there any way to send ClientboundPlayerInfoPacket with name longer tha 16 chars?
What is the best way to run code everytime a new day starts on a world?
theres no timechange event, you probably want to use a runnable to check when it becomes day
alright, thanks
myeah, I mean often the data and objects you represent could be clearer since pair, our just a tuple can be quite abstract
but this often depends on situation and context
yea def
sometimes an implementation pattern will be just as explanatory with a tuple... sometimes not
I also used Tuples/Pairs
ye
but I always try to create a class/record which represent it instead of a Tuple/Pair
yuh, well my general rule is if the class is gonna be exposed to other modules, or to the world of api consumers
then go for a record/class
Is it possible to play a sound to a player using packets in bungeecord?
else if its just an impl detail, why not keep it a tuple/pair and let the variable name explain its duty
ye
you can implement a comparator that knows about the map instance
and uses Map::get (on the keys)
im still working on that cache thing

and maybe its a good thing to sort the entries based on the time when they should be executed
what Redempt said
mye why not
actually im thinking about what the advantages would be
that i could just stop searching when i reach an "invalid" entry
and maybe the lookup time for the map? idk
wut records can implement stuff
thats new for me
How can I use NMS with Gradle?
repositories {
mavenCentral()
maven {
name = 'spigotmc-repo'
url = 'https://hub.spigotmc.org/nexus/content/repositories/snapshots/'
}
maven {
name = 'sonatype'
url = 'https://oss.sonatype.org/content/groups/public/'
}
}
dependencies {
compileOnly 'org.spigotmc:spigot-api:1.19-R0.1-SNAPSHOT'
}
nope they cant extend
ye since they extend the java record class
run bt for 1.19
then switch the artifact if the dependency from spigot-api to spigot
i'll try this ty
never implemented comparable lol and Instant doesnt seem to have a compareTo method
i guess compare the time between now and the instant
Instant implements Comparable
it didn't worked, all of my imports are broken
owh bruh ye youre right
i was checking the wrong generic parameter
love it cant even use a lambda
Hello everyone !
I have bugs with something :/
I'm trying to get the amount of items crafted.
Here is my code: (Spoiler: I've got it from spigotmc.org)
private ItemStack getCraftedItem(CraftItemEvent event) {
if (event.isShiftClick()) {
final ItemStack recipeResult = event.getRecipe().getResult();
final int resultAmt = recipeResult.getAmount(); // Bread = 1, Cookie = 8, etc.
int leastIngredient = -1;
for (ItemStack item : event.getInventory().getMatrix()) {
if (item != null && !item.getType().equals(Material.AIR)) {
final int re = item.getAmount() * resultAmt;
if (leastIngredient == -1 || re < leastIngredient) {
leastIngredient = item.getAmount() * resultAmt;
}
}
}
return new ItemStack(recipeResult.getType(), leastIngredient);
}
return event.getCurrentItem();
}
My problem: If I'm trying to craft things like my screenshot, it will crash only 1 mushroom stew, but it will count as 64.
How can I fix it please ?
I'm trying to fix this *** since 2 days 😭 😭
If you want to compara two objects which dont implement comparable then you should not
extend them but implement a Comparator<T>
the thing is that i want to compare by value, in a treemap
so the key should be aware of a map where both the key and the value are in
Count result items during and one tick after the event
Wdym ?
Doing something like itemsResultCountAfter - itemsResultCountBefore ?
wut? why? The treemap sorts by the Comparator. Why would you need a reference to the TreeMap?
ye mb
it shouldnt be the treemap but another map
actually i guess its impossible what im doing
lemme use my last braincells
sounds like a flawed design...
I honestly didnt find a better way when i had to deal with this myself.
Alright, it's still a beautiful way.
Thank you ♥
ah i get it, i need to know the value which is used on the treemap::put and compare that
but comparator compares on keys
so i thought lets get the value from another map, based on that key
but there is no such map
How would I set an itemstack in customconfig (data like displayname, lore etc) without making the whole item
it implemnts confiuration serialzable
How to import custom animations?
And apply them to entities?
PS: For performance reasons: You just need to look at the crafting matrix and the amount of the result ItemStack.
In fact, only the matrix slot with the lowest amount.
Then you do
recipesTriggered = smallestBefore - smallestAfter
And
itemsCrafted = recipesTriggered * resultSingleAmount
if someone here knows anywhere I can read about making custom item.yml file I would appriciate it. Cant find anything
just throw an ItemStack or a List<ItemStack> into a config. Spigot can handle that.
up :)
stackoverflow doesnt seem to help alot, those things only make the efficiecy worse
But I read somewhere that if I use something like getCustomConfig().set("path", item); it would generate type, displayname, lore etc when generated
is that a false statement
Well, this is a bit complicated to me, maybe there's some things I don't understand xD
Gonna check it, ty
Not sure what you mean by "generate" but it would write the ItemStack into "path"
@lost matrix Sorry for the ping, do you accept that I try to DM you when I've finish to fix this ?
Just to be sure I'm not doing weird things
yep
anyways i can just leave the collection unsorted but that wont be really good for performance. But ye i dont have much entries so probably doesnt matter
I would like to use it as second actionbar
you can modify it through some hacky stuff but it's very fuggly
yeah
As in, change the item's name, update inv
but I wouldn't recommend it
The inventory would flicker a bunch, some issues can occur if the player opens their inv
the actual message is probably client sided and u cant do much about it
but as said above you could try changing the items name
dam it
I would recommend maven for Spigot and gradle for Paper.
Just because of the special-sources and userdev plugins respectively.
This is a very tricky question. There are several approaches ive been through. Everyone of them has its drawbacks
and all of them are quite complicated.
Error: https://paste.md-5.net/boxebinuwa.cs
Code: https://paste.md-5.net/boxebinuwa.cs
Error line 24 in main class is onEnable() { FileManager.createCustomConfig(); }
FileManager.instance is null
Make sure it is not
but why is it null
ur instance is null
because you didnt initialize it
i wanted to say that 😠 xd
im currently storing a function that will remove an entry from a map, do i better save it as a Runnable or a Consumer<K>? so with the first one it would be () -> map.remove(key); and second one map::remove
both ways work
only difference is that the code for the 2nd one is a bit longer (ignore the errors)
I fixed the instance problem, but now new error https://paste.md-5.net/boxebinuwa.cs
Same error. You didnt fix it.
7smile7 I have a question. I need to construct some predefined ItemStacks and I'm curious what you think a good way to do that is. Static is a given, but every way I think of doing it seems so wrong.
Still same
I'm really confused
how does it look?
https://paste.md-5.net/etesepevah.cpp
Really depends on how you want to look at them.
Are they constants or are they mutable (data driven, even)
they are immutable
i know this sounds stupid but what are the differences between a map, hashmap and collection xD
ok thx
Put them in an enum. You dont want to get the ItemStacks but always call .clone() on the template ItemStacks.
Otherwise you will run into problems.
okay thanks for the help
What do I need to change
this is the main class
Just got my response, my brain sometimes disconnect -_-
Thank you so much 7smile7, it's working very well ^^
Example:
@Getter
@RequiredArgsConstructor
public enum CustomItemType {
FLAME_SWORD(
ItemBuilder.of(Material.IRON_SWORD)
.name("§6Flame Sword")
.lore("", "A cool flame", "sword")
.enchant(Enchantment.FIRE_ASPECT, 5)
.build()
),
FLAME_BOW(
ItemBuilder.of(Material.BOW)
.name("§6Flame Bow")
.lore("", "A cool flame", "bow")
.enchant(Enchantment.ARROW_FIRE, 5)
.build()
);
private final ItemStack itemStack;
public ItemStack get() {
return itemStack.clone();
}
}
why has this baby horse gone stupid
it wants to drink water
but also wants to follow parents
fun I have to package events with my items lol 🙏 thank you
and it can't decide between the two so it keeps turning around over and over again
this.goalSelector.addGoal(1, new PanicGoal(this, 1.2D));
this.goalSelector.addGoal(1, new RunAroundLikeCrazyGoal(this, 1.2D));
this.goalSelector.addGoal(2, new HorseBreedGoal(this, 1.0D));
this.goalSelector.addGoal(4, new DrinkWaterGoal(this, 1.0D));
this.goalSelector.addGoal(5, new EatSeedsGoal(this, 1.0D));
this.goalSelector.addGoal(6, new FollowParentGoal(this, 1.0D));
this.goalSelector.addGoal(7, new WaterAvoidingRandomStrollGoal(this, 0.7D));
this.goalSelector.addGoal(8, new LookAtPlayerGoal(this, Player.class, 6.0F));
this.goalSelector.addGoal(9, new RandomLookAroundGoal(this));
even though DrinkWater has a higher priority compared to FollowParentGoal
sight
actually whats recommended for a builder pattern: new ItemBuilder(material).stuff() or ItemBuilder.from(material).stuff()?
so exposing constructor or not
do you know anywhere with item.yml custom config
i sent a link somewhere above
Yes I looked through it but it does not contain anything about storing items or how to set them.
yes but it gives error wait
it will be serialized automatically cuz ItemStack implements ConfigurationSerializable
hmm
did you put it in the resources folder?
thats the easiest way, you can also create a new file and write the stuff manually
but like the config.yml, a prewritten config with defaults is always the easiest
in the resources folder?
Yes
Main: https://paste.md-5.net/kegorocicu.java
FileManager: https://paste.md-5.net/sesujavira.java
ItemManager: https://paste.md-5.net/dutawafara.cpp
Lmao
it didnt copy the right link
theyre all the same url
wait
lmao
ye
aight
Now
you arent saving the file when setting stuff to it anyways
but that looks about right
to tired to see whats wrong lmao
but can we see the file structure of your plugin to see if you put the file in the resources folder
like this
I cant paste picture here?
!verify
Usage: !verify <forums username>
or use some pasting site idc
yo, i want to load a jar file dynamically from a plugin and have it be accessible across all other plugins
the only problem is that parenting it to this.getClass().getClassLoader(), this.getClassLoader() (<-- didnt work at all) or JavaPluginLoader.class.getClassLoader() dont work (where this is a JavaPlugin)
i also tried to reflectively invoke URLClassLoader.addUrl(URL), but the setAccessible(true) method throws a IllegalAccessException stating that i cant reflectively access the method
code for this method:
private static Method uclAddUrl;
static {
try {
uclAddUrl =
URLClassLoader.class
.getDeclaredMethod("addURL", URL.class);
uclAddUrl.setAccessible(true);
} catch (Exception e) {
uclAddUrl = null;
}
}
// ...
/* some function */ {
uclAddUrl.invoke(/* the JavaPluginLoader class loader */ classLoader, url);
}
so now im wondering if this is even possible, and if so, how would i do it
reason its red on ItemManager is that i was trying to make something to save when I set the item
uhh i dont really know
ah wait
maybe just call saveDefaultConfig in your plugins onEnable method
dont think so but i will try
what i have been doing for the past five hours lol
https://paste.md-5.net/qajovuvoku.cpp
hmm actually i might want to start the task whenever a first value is added
how do i get the bukkit world from an nms level
How do I ignore Citizens NPCs?
Caused by: java.lang.ClassCastException: net.citizensnpcs.nms.v1_8_R3.entity.VillagerController$VillagerNPC cannot be cast to org.bukkit.entity.Player
It does not work, it just gives me a blank item.yml
and youre loading it with fileConfig = YamlConfiguration.loadConfig(file)?
customConfig = new YamlConfiguration();
try {
customConfig.load(customConfigFile);
} catch (IOException | InvalidConfigurationException exception) {
exception.printStackTrace();
}
}
}
dunno why people dont use that static method
?
30.06 18:24:47 [Server] java.sql.SQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '' at line 1
30.06 18:24:47 [Server] at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:120)
30.06 18:24:47 [Server] at com.mysql.cj.jdbc.exceptions.SQLExceptionsMapping.translateException(SQLExceptionsMapping.java:122)
30.06 18:24:47 [Server] at com.mysql.cj.jdbc.ClientPreparedStatement.executeInternal(ClientPreparedStatement.java:953)
30.06 18:24:47 [Server] at com.mysql.cj.jdbc.ClientPreparedStatement.executeUpdateInternal(ClientPreparedStatement.java:1098)
30.06 18:24:47 [Server] at com.mysql.cj.jdbc.ClientPreparedStatement.executeUpdateInternal(ClientPreparedStatement.java:1046)
30.06 18:24:47 [Server] at com.mysql.cj.jdbc.ClientPreparedStatement.executeLargeUpdate(ClientPreparedStatement.java:1371)
30.06 18:24:47 [Server] at com.mysql.cj.jdbc.ClientPreparedStatement.executeUpdate(ClientPreparedStatement.java:1031)
30.06 18:24:47 [Server] at CallousPvP-1.0-SNAPSHOT.jar//me.uncoding.callouspvp.datamanager.SQLGetter.createTable(SQLGetter.java:25)
30.06 18:24:47 [Server] at CallousPvP-1.0-SNAPSHOT.jar//me.uncoding.callouspvp.CallousPvP.onEnable(CallousPvP.java:52)
public void createTable(){
PreparedStatement ps;
try{
ps = plugin.SQL.getConnection().prepareStatement("CREATE TABLE IF NOT EXISTS callouspvp " +
"(UUID VARCHAR(100),NAME VARCHAR(100),FFAKILLS INT(100),FFADEATHS INT(100),NETHPOTINV VARCHAR(100),PRIMARY KEY (UUID)");
ps.executeUpdate();
} catch (SQLException e){
e.printStackTrace();
}
}
for context i have been trying to make customizable duels layouts that you can save but i'm having problems with the saving so if anyone could help me figure out what this error means then i would appreciate it
how can i check if a repeating task is already scheduled? (so task.runTaskTimer has been called) I saw the method BukkitScheduler#isCurrentlyRunning and isQueued but im not sure which ones to use
you have to use a customFile called item.yml and set the items
😛
what
Did you try validating the code you're running?
what do you mean by that?
i will try this out whenever needed thanks for the suggestion
hello, i has worked with java on a long time ago..
how can i use the api in my sendMsg construct
public class init {
public static void main (String[] args) {
final TS3Config config = new TS3Config();
config.setHost("82.165.107.47");
config.setEnableCommunicationsLogging(true);
final TS3Query query = new TS3Query(config);
query.connect();
final TS3Api api = query.getApi();
api.login("xx", "xx");
api.selectVirtualServerById(2);
api.setNickname("MCP :: SERVERBOT");
api.sendChannelMessage("bot");
};
public void sendMsg(String[] atgs) {
this.api.sendChannelMessage("CONNECTED")
}
};
What is the way to put an array of ItemStack in a chest inventory and spread it randomly?
Hey I have a question. What defines a plugin? I'm asking this because i'm using PersistenDataStorage and you have to give a plugin instance. But what defines this, would it be possible to start a new project and have the same plugin instance so you can access the storage?
yea you can use whatever main instance you want as long as its a JavaPlugin
Yes but if it's different you can't access the data from the other instance
you can actually just take another plugins instance by using JavaPlugin#getPlugin(Class<T extends JavaPlugin)
though its not advised
for storing data use a database or yaml file
pdc is best for small snippets
Its like storage for keycard doors to store which door is which but my question is how a plugin instance is unique
Like if i update my plugin code
it's still the same plugin
yes but if i open a new project and try to access the pdc on a door from that project it won't recognize it
I'm not sure how it works in the back end but if your changing your main class name and spot every update idk what your even doing
no
but you can just use that other plugins instance to retrieve keys
ideally if you want to use them for other projects make an API endpoint
No it doesn't fine the keys because its another instance
Yeah thats the best, i just reference the other plugin now
set up an API for your plugin right now to access those keys
than use maven to import the API
I'm just curious what makes the instance unique to learn how it works
its a per plugin identifier that identifies what plugin it is
a namespacedkey only needs something that extends JavaPlugin
in no way is a plugin instance like a UUID though
I seriously don't see the issue here an API end point to access the keys and using that API is really all you need
Okay thanks
public String getInventory(UUID uuid,String stat){
Configuration CallousConfig = CallousPvP.getInstance().getConfig();
try{
PreparedStatement ps = plugin.SQL.getConnection().prepareStatement("SELECT " + stat + " FROM callouspvp WHERE UUID=?");
ps.setString(1,uuid.toString());
ResultSet rs = ps.executeQuery();
String stats = CallousConfig.getString("Default"+stat+"InventoryContents");
if (rs.next()){
stats = rs.getString(stat);
return stats;
}
}catch (SQLException e){
e.printStackTrace();
}
return CallousConfig.getString("Default"+stat+"InventoryContents");
}
this returns null and i want it to return what's in the config if the player doesn't have anything for the stat. does anyone know how i would fix this?
if its returning null it means the path doesn't exist you probably got the wrong path or something
is it possible to make a passive mob attack a player with nms
okay i might know why. i'm going to check it out real quick
make sure if its nested you have dots between the path
location.getBlock().setType(Material.CHEST);
Chest chest = (Chest) location.getBlock();
how does this produce a ClassCastException? the chest definitely is there
that just means you can't cast Chest to a block
give me a second checking forums
Cast the BlockState
oh
location.getBlock().setType(Material.CHEST);
Chest chest = (Chest) location.getBlock().getState();
like that?
si
I got a try/catch block, is instanceof better?
yes
ok, will do it then
The Java instanceof operator is used to test if the object or instance is an instanceof the specified type (class or subclass or interface), how downcasting in java is possible with instanceof operator:
thanks
i don't think it's the wrong path but here's what the config looks like on the server that i'm testing it on
String invstring = data.getInventory(P.getUniqueId(),"NETHPOTINV");
System.out.println(invstring);
and that prints out null when i try to get the inventory
send your Config class that contains getInventory etc
okay
in a pastebin or do you want the file itself?
?paste
send the config too
okay
How can I rename a chest title? Like you would rename it in anvil
G'day, I have a (hopefully) quick question, for which I couldn't find a straight answer for:
I'm having an issue with Vault, it throws a NullPointer exception whenever I try to use: econ.depositePlayer(p, 0.0d).
And I can not find out why, since both p and econ are not null.
send the full stack trace
?paste
it says Something went wrong! when i try to save the code
Use another economy plugin
Indeed, as it was the first one I could et a download for
Like Essentials
teh issue is your economy provider as Olivo said
Thanks <3
