#help-development
1 messages · Page 1052 of 1
public void updateBossBarForPlayer(Player player) {
BossBar bossBar = playerBossBars.get(player.getUniqueId());
String compass = generateString(player.getLocation(), 32);
bossBar.setTitle(compass);
}
public String generateString(Location location, int displayLength) {
String baseDirections = "N-E-S-W-";
int separatorsCount = displayLength - baseDirections.length();
StringBuilder baseCompass = new StringBuilder();
for (char direction : baseDirections.toCharArray()) {
if (direction != '-') {
baseCompass.append(direction);
for (int i = 0; i < separatorsCount; i++) {
baseCompass.append('-');
}
}
}
for (Map.Entry<Waypoint, String> entry : waypoints.entrySet()) {
Waypoint waypoint = entry.getKey();
String indicator = entry.getValue();
int waypointIndex = calculateWaypointIndex(location, waypoint.getLocation(), baseCompass.length());
baseCompass.setCharAt(waypointIndex, indicator.charAt(0));
}
double yaw = location.getYaw();
int directionIndex = (int) ((yaw / 360.0) * baseCompass.length());
int halfDisplayLength = displayLength / 2;
int start = (directionIndex - halfDisplayLength + baseCompass.length()) % baseCompass.length();
int end = (start + displayLength) % baseCompass.length();
if (start < end) {
return baseCompass.substring(start, end);
} else {
return baseCompass.substring(start) + baseCompass.substring(0, end);
}
}
private int calculateWaypointIndex(Location playerLocation, Location waypointLocation, int compassLength) {
double deltaX = waypointLocation.getX() - playerLocation.getX();
double deltaZ = waypointLocation.getZ() - playerLocation.getZ();
double angle = Math.toDegrees(Math.atan2(deltaZ, deltaX)) - playerLocation.getYaw();
angle = (angle + 360) % 360;
return (int) ((angle / 360.0) * compassLength);
}
im trying to make a compass system like skyrims on a bossbar, however the waypoint dont display on the bar properly
?paste
not entirely my code lul, but on its own it works fine, its just when adding waypoints that it breaks
it infact works just fine
Whats ‘not properly’?
Do they display at all?
they display but they dont move on the bar properly, so if you turn 180 degrees and teleport to the waypoint and go behind it, it doesnt appear on the bossbar as it should
or if you just move around the waypoint it desyncs
it updates on playermove
shouldn't it be taking displayLength into account
becuase its mapping it on a point from 0-compassLength right
if you could get a vid of it would help visualise it a lot better
i donthave recording software atm im on a shoddy lil laptop 😭
for testing atm ive just hard coded it to be the baseCompass string
yeah if angle is 359 its gonna do 359 * compassLength
then you try to set baseCompass char to that
it'll be way out of index
can I just do Config.set(String, HashMap);?
so what should i set it to?
Yes as long as the hashmap contains primitive and string types. These types could also be in collections or sub maps as well
Great then, HashMap I wanna save is <String, String>
44 atm
yeah
(HashMap<String, String>) savedataConfig.get("data");```
Something like this should work?
So x * (360/44)
Nope, it doesn't work. Cannot cast
You need to cast to map
The type isn't guaranteed to be HashMap
Moreso a set map maps to a configuration section though retrieving as you are should work
Yep, I think I will deserialize it myself
I think bukkit uses LinkedHashMap to maintain order
But casting to Map is just objectively safer
Okey
Cast it to Map<String, Object> and it's safe
It cannot be casted to map either
class org.bukkit.configuration.MemorySection cannot be cast to class java.util.Map
It's still useless
as I cannot create HashMap<String, String> from it
I will just deserialize it myself
yeah ik
new HashMap<String, String>((Map<String, Object>) savedataConfig.getConfigurationSection("data").getValues(false));```
why are you casing it to a map still
This looks quite unsafe
and you wont be able to cast all values to a string
Why tf do you even need a hashmap
It makes no difference, it's just a map
It's most likely going to be some type of a hashmap anyways and it literally does not make a different
if you are putting and getting a Map from teh config you have to be careful how/when you fetch it
If you just added it and have not saved/reloaded the config, it will still be a Map. If you have done a load after save it will not be a Map but a MemorySection
/**
* If loading from file the Maps in the data
* will be stored as a MemorySection not Maps.
*
* @param entry MemorySection or Map to check.
* @return Map containing the serialised data.
*/
@SuppressWarnings("unchecked")
protected Map<String, Object> castToMap(Object entry) {
if (entry instanceof MemorySection) {
return ((MemorySection) entry).getValues(true);
} else {
return (Map<String, Object>) entry;
}
}```
idk I always have done like this
so I should just drop HashMap and use Map instead?
Yes, you map variables should always be of type Map
https://pastes.dev/YjIXhOxWyG I am creating a npc plugin for corpses 1.16.5, this code is executed after entitydeathevent, but the NPCs do not appear, although they are visible in the tab. Can someone help me?
when a player leaves the server if its saved in some class it becomes null right?
p.sendPacket(new PacketPlayOutNamedEntitySpawn(corpse));
No
Thats how memory leaks happen
it looks like the problem is that I have to send PacketPlayOutPlayerInfo first
is there any way to protect database credentials when pushing into github private repo server configuration files?
i can probs use .gitignore but usually database credentials are inputted using configuration files where more than database credentials exist
just leave the config empty in the project?
how can i forward those things to plugins which do not support env variables
the git repo existence is to store server configuration files that are only impacting gameplay but not the technical details like credentials, etc
i could probs craft some bash script with sed awk tools to read config and replace placeholders
smth like this
# startup.sh
# Fetch IP address from an environment variable
DB_HOST=$DB_HOST_IP
# Update the plugin configuration file
CONFIG_FILE="path/to/plugin/config.yml"
sed -i "s/DB_HOST_PLACEHOLDER/$DB_HOST/" $CONFIG_FILE
# Start the Minecraft server
java -jar spigot.jar
:harold:
whats wrong
Why PacketPlayInUseEntity doesn't work when I attack a sleeping entity?
Because you're not right clicking?
Attacking would trigger the attack packet
whatever the name of that is
do sleeping entities have a hitbox on 1.16.5?
I'd assume so
public void inject() throws NoSuchFieldException, IllegalAccessException {
CraftPlayer nmsPlayer = (CraftPlayer) player;
ChannelDuplexHandler channelDuplexHandler = new ChannelDuplexHandler() {
@Override
public void channelRead(ChannelHandlerContext channelHandlerContext, Object packet) throws Exception {
if (packet instanceof PacketPlayInUseEntity) {
PacketPlayInUseEntity usePacket = (PacketPlayInUseEntity) packet;
System.out.println("fd");
if (usePacket.b().equals(PacketPlayInUseEntity.EnumEntityUseAction.ATTACK)) {
int entityID = (int) getValue(usePacket, "a");
if (tracker.getNpc(entityID) != null) {
System.out.println("click");
new BukkitRunnable() {
@Override
public void run() {
Bukkit.getPluginManager().callEvent(new RightClickCorpse(player, tracker.getNpc(entityID).getHandle()));
}
}.runTask(Corpses.getPlugin(Corpses.class));
}
}
}
super.channelRead(channelHandlerContext, packet);
}
@Override
public void write(ChannelHandlerContext channelHandlerContext, Object packet, ChannelPromise channelPromise) throws Exception {
super.write(channelHandlerContext, packet, channelPromise);
}
};
ChannelPipeline pipeline = ((CraftPlayer) player).getHandle().playerConnection.networkManager.channel.pipeline();
pipeline.addBefore("packet_handler", player.getName(), channelDuplexHandler);
}```
?paste
?codeblock
You can use the discord code block format to display code or just text in a more pleasing way:
```java
public class MyPlugin extends JavaPlugin {
@Override
public void onEnable() {
}
}```
Becomes:
public class MyPlugin extends JavaPlugin {
@Override
public void onEnable() {
}
}```
breaks on oldmobile btw lol
It doesn't work if I attack the sleeping entity
everything works with regular ones
for some reason some mobs are immune to Poison damage, is there a way to remove the immunity?
I haven't logged into Spigot Stash for a while, anyone know why my account would have been deactivated?
Only undead mobs should be
They have the effects flipped
poison acts as regen and regen as poison
just give them regen instead lol
instant health as instant damage
instant damage as instant health
for some reason it doesn't work on sheep or chickens either
Sounds like a bug
Make sure you're up to date and you don't have a plugin messing with it
// Create the potion effect
PotionEffect potionType = new PotionEffect(PotionEffectType.POISON, finalPoisonTimer, poisonLevel, false, false, true);
it works on creepers and other mobs
Email md
?support
It seems that the spigotmc API for getting the latest version uses a cache. Anyone know how often it is updated?
I'm talking about this one: 'https://api.spigotmc.org/legacy/update.php?resource=<Your Resource ID>'
I updated a typo in my resource's version 9 hours ago but the URL still shows the old version
also I notice it has legacy in the URL name, perhaps there's a newer method that should be used?
shows 4.0.6 b35 for me
this is what I get
(Invoke-WebRequest -Uri 'https://api.spigotmc.org/legacy/update.php?resource=74304').Content
v4.0.6 b35
that is the latest version
I removed the v early this morning
🤷♂️ the plugin is still returning it but yeah I'm sure it is cached somewhere
the plugin on your local machine would have the cached stuff for you, i just checked on my machine and its got no v
Looking for a little advice. So iv made it so when a player has SAFE-MINER on their pick the item they mine will go straight in their inventory and not drop on the floor but will drop on the floor when invin is full
Problem im having is when a player mines with Slick touch it dont give the slik touch item same with if they have fortune fortune dont work.
How would I go about making so they work ?
ItemStack item = p.getInventory().getItemInMainHand();
Block blockMined = e.getBlock();
blockMined.breakNaturally(item);
//This grabs the item the user mined
Collection<ItemStack> drops = blockMined.getDrops();
//This gets the item dropped
for(ItemStack drop : drops) {
e.setDropItems(false);
//If it is full it will return message.
HashMap<Integer, ItemStack> leftItems = p.getInventory().addItem(drop);
//This checks if their inventory is full
if(leftItems.size() == 1){
e.setDropItems(true);
}
}```
My code
Don't use getDrops like that
Pass the ItemStack to the getDrops method (the player as well while you are at it)
FileConfiguration cfg = ZenTP.getPlugin().getConfig();
Player p = (Player) e.getPlayer();
if (e.getView().getTitle().equals("§8ᴄᴏɴꜰɪʀᴍ ʀᴇQᴜᴇꜱᴛ")){
cfg.set("gui." + p.getUniqueId() + ".guiplayer", true);
}
}```
why does this dont work
Just use the https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/block/BlockDropItemEvent.html
declaration: package: org.bukkit.event.block, class: BlockDropItemEvent
instead
im thinking of implementing CI/CD for my server configuration files, im kinda noob at it, but that's what im thinking on:
creating a bash script which launch the server but before it does, it would check if the build was successful in the main branch, if it was it would pull the latest files from git repo and launch the files with the latest files
but im not sure what's the best way to implement this
Forgot EventHandler annotation?
Forgot to register the event?
@clear elm
using plain old bash seems kinda hacky
uh wrong reply?
Yeah
what is a annotation
That sounds like a job for Jenkins
@EventHandler
i have this
im not talking about plugin artifacts
but about server configuration files
@EventHander
public void onSomeEvent(SomeEvent event) {
}
i forgot to reload the server 💀
the code works i just forgot to reload lol
Ah, in that case: Jenkins
Never reload
why its a test server
Bc you would have to register a webhook to start your server.
Jenkins can run directly on your server and launch applications.
Doesnt matter
Still doesnt matter. Do a proper restart. Dont reload.
Reloading will eventually lead to atrocious problems and errors, even "with just one plugin".
You will pull your hair out, trying to find a bug.
okay lol
tbh spigot should remove /reload command
How can I programm a permissions system with groups and more?
and your not using luckperms or any other perm plugin because
I feel like the permission game was already played through by LuckPerms.
Its either that, or a completely custom system that doesnt rely on spigots permissibles.
That is exactly what i did 🫡
no
But that only viable because i dont use a single external plugin and the whole system is custom from the beginning.

if I PluginManager#loadPlugin will it enable the plugin when needed?
what does it mean?
Hello guys, I need help again, I tried to use a textured GUI but it isnt working, here is my texture and I use a custom function to create a menu

If you define a property, you might as well use it:
<source>${java.version}</source>
<target>${java.version}</target>
If you choose a target and source version, then you should make sure the maven-compiler-plugin is on a version
that actually supports the selected jvm version.
Also make sure that your projects selected jdk can compile this version.
Project > Structure > jdk
something like that
§ raised eyebrow emoji
Ah it was $
Are you from Sweden smile?
I could've sworn that symbol is nearly exclusvive to Swedish keyboards
gestankbratwurst
Sweden
Would that work the same tho
bump
§ 
Is it on the German keyboard too?
Yea
Is it used in your grammar or something
its a paragraph symbol
Wtf very confused American rn
Do yall use the paragraph symbol instead of indents or something kekw

That sounds like a resourcepack problem. Explain exactly what you are doing, what you expect to happen, and what is
actually happening. Code snippets included.
mfw people still use source/target rather than release flag
The only code needed was the one I provided and I am trying to use that custom textured GUI on a specific menu
mfw people use spigot instead of CabernetMC
cabaretmc 💀☠️
cavendishmc
💪👍🙏
carbonaramc
Not sure anyone will actually open your resourcepack and double check if you properly added font characters in there...
Sounds like you need to debug this step by step.
I followed a tutorial, just didnt used Deluxe Menus like he did
i like checking whether they added characters like negative spaces to the default font and whether their chat is protected against it
have found like 5 servers who haven't protected stuff
?1.8
Too old! (Click the link to get the exact time)
Imagine just spamming the GUI textures in chat
i love doing that
this too :D
i cant even open it
multiline chat messages go brr
prob for the better
Looks like the resourcepack isnt loaded or malformed
how can I get a wellformed resourcepack?
wellformed ❓
xd
idt that's a word
By using your file explorer and assembling it in a way that is supported by minecraft
you write it correctly 
thinking about writing a web interface now to create custom items 🤔
wouldnt you still need to register webhook in github to poll for changes from repository?
somebody is working on that, but for cusotm GUIs
who
it isnt working still...
lol
are you building 500x the hypixel plugin?
?whereami
Hey there, I'd like some advice because I'm starting to think I might be in the wrong.
I have a bounties plugin used by some people that displays a prefix [Plugin Name] <message> on plugin broadcadsts. It's not very evasive and that's the only kind of plugin advertisement that it gets in-game. A user is being quite pushy with the idea of me adding a way to remove the prefix, and I don't think I should.
I don't get any revenue from the plugin and I do it for fun. I'd appreciate any feedback, thanks.
Users don't like their players knowing what plugins they use
The chat messages and the prefix can be changed in colour, and the chat messages can be changed in content
Feel free to ignore them
I seriously don't see how it's a huge issue
Thank you!
wouldnt want to know either
They're just afraid someone will copy them
which really isn't that hard
when the plugins are just a google search away
Yeah
hello
They've used the argument of it not being suitable for big networks
But big networks would get their own plugins made...
guys is there any way to send player to another server with my hub plugin. i already installed bungeecord but my plugin of hub i programmed it with spigot version so, i have issue to send the player to another server.
No libraries for bungee.yml?
also, is plugin messaging safe from player sending their own custom payload packets?
plugin messaging is custom payload packet
i know
Channels need to be registered from the server side. The proxy will simply throw away any custom packets on channels which are unregistered or not suitable for clients
alright
eg the BungeeCord channel is reserved for server-proxy and back
does the proxy not let it pass through? registering channels isn't really a thing in the protocol
the main question is, player cannot hijack into plugin channel and send malicious packet to the backend?
it can, you have to cancel the event on the proxy if the sender is the player
how can I ensure an array's thread visibility?
I was almost sure the proxy doesnt allow packets on the BungeeCord channel
so when one thread modifies an array's content, how can I ensure that if another thread tries to read it, it gets the updated value?
well, not that one, but the rest
Yeah the rest ofc ^^
wow a chanell with meaningful conversation
you can use varhandles on arrays
velocity > bungeecord
Lookup#arrayElementWhatever
im working for a client
so I guess Unsafe for java 8
i already know
tell your client
wont work
I mean, there are like 5 events on bungeecord
you can just check the classes in the event package
ah yes, gotta rebuild the whole server setup just because dev wont work with bungeecord for money
thats why im asking
After the client is done with authorisation the PostLoginEvent is called
LoginEvent is called earlier
PreLoginEvent even more ^^
can't find it
ah they're the static methods in MethodHandles
Hm would be interesting to know if volatile is transitive for arrays
/\
The field, i figured
ensures thread visibility for same object array changes
How would varhandle help in that regard?
you can perform operations on a specific element as if they were volatile
Sounds like an array shouldnt be used here...
also, array elements are independent, as in, a thread mutating element 0 won't be affected by a thread mutating element 1, so it's perfectly thread safe for threads to operate on separate elements :)
how do i do ignorecancelled in bungee?
if (cancelled) return
doesnt seem to work
theres no event.iscancelled
what?
not all events are cancellable
elaborate on your logic
then what is kicking player when hes trying to log in?
not cancelling the login event?
what
isnt post like after?
after when the player is right about to join a server
It wouldn't make sense to cancel the post login event, should be yeah that ^
if you want to deny login, use the login event
post login is post login
you deny login not past login
PostLogin means client is already connected correct?
pre login - can this mfo log in?
post login - this mfo has logged in
Thread safety should be delegated to an object rather than granularly on data structures or arrays.
Meaning you should probably write a class which handles thread safe access on arrays or find a datastructure in java
which supports this already-
yea but if loginevent is cancelled (which should happen in kick case) postlogin event shouldnt even be called
correct
Right
write a class which handles thread safe access on arrays I mean
pretty much
what I'm doing
kind of
I mean there can be cases where that matters, hence why varhandle exists and lets you do that
also many data structures are generalized and can do a lot of sometimes unnecessary (in my case) things to ensure thread safety
for the same reason you'd mark a field as volatile or use atomicinteger classes or whatever
like synchronizing or creating a copy for a read
What do you do when you don't know what to do?
sleep
cry
Already had my nap
I write C when I'm bored
write assembly methods and implement them into java with JNI
You guys are so funny
I'm not joking lmao
I don't do that
that was supposed to be a suggestion for Emily
I wrote a hash table in C a couple days ago because I was bored
Literally just because you're bored?
sure
okay, friend is lost
on the internet people also don't seem to be using array MethodHandles much
is this correct?
I mean, it's possible
Hi, what happen if I call plugin disabling
several times?
Probably nothing or several errors
okay thanks
when you schedule a repeated task with some interval does it wait until previous iteration or whatever its called is done executing?
could word that
in english
could word that? what does that mean
say it in an understandable way
im not a native english speaker as you can see
wait until previous iteration what does that mean?
what on earth are you doing?
array accessed and modified possibly by a few threads
for example does it wait for previous execution to complete executing?
Yes a repeating task will not start teh next iteration until the last is complete
even if i have interval between them?
bruh
yes
that's intended tho
one completes, then the delay between, then the next runs
even if the delay is zero
on disabling how it work? all instance into the plugin got deleted? and all threads are stoped ?
depends on how the plugin itself implements it
^
You can technically do anything you want in the onDisable, doesn't mean it will work tho
if I dont do anything what happen?
thread opened keeps open?
yes
I mean
okay thanks
Your plugin usually runs on the main thread
so as long as the server is still running then
I make a few of my own threads
like 6 of them
jeez kek
that methodhandle works atomic but is it also threadsafe? (tbf ive seen the same approach being used in minestom)
2 for monitoring, 1 for thread pool task delaying, 2 for purely astnc task execution
/n
so 5
this
thanks
with intellij it's pretty clear
I have absolutely no idea
VarHandle get/setVolatile
it's my first time using it
is a bad thing to Bukkit.getServer().shutdown(); on disable? (if its called because the server is already shuting down?)
yes
like, that will just ensure the changes are visible from other threads, it doesn't mean anything that your usage of the arrays in your application is thread safe
it's a very bad thing
don't do that
volatile doesnt mean threadsafe?
yes that's what I said
it means visible at all times
Uh this would shut the whole server down I'd imagine
the plugin can be disabled my plugman by itself
it also might cause some looped errors
volatile means volatile, means writes are flushed directly to main memory and reads aren't cached locally, it also means the compiler won't potentially optimise away certain usages of it
yep
volatile only means threadsafety when theres only one thread writing
that's why volatile field access is usually ~100 times slower
Your onDisable should be kept to handle the cleanup aspects of your plugin
I mean, it entirely depends on how the application uses it
so, not necessarily
Yes, so I shutdown it out on disable
volatile doesn't "mean" thread safety, it's just a step towards it
why using volatile then? xd
don't do that
also?
If you do the Bukkit#getServer#shutdown, that would shut the whole server down
Not your plugin specifically
(technically dots is the right thing there)
if volatile is all you need for your usages of it to be thread safe, then congrats, you've achieved thread safety rather cheaply
Yeah well
yes I am trying to do that, if the plugin don't work I need to stop all the server
is # used for static?
no
Uh no
# is used for instanced
with a back slash
Bukkit.getServer().shutdown();
That is an incredibly awful thing to do @sterile breach
\AAAAAAA
or a single hashtag
#AAAAAAAAAAA
Xes
really?
Yes
Why would you shut down the server if YOUR plugin doesnt work?
HOW DID YOU TYPE THIS VERY SENTENCE THO
with a backslash before the hashtag
There's no server that only runs a single plugin kek
(unless you're like dev testing)
but something like sending a player a component message would be Player#spigot().sendMessage as the # signifies the Player would need to be an instance and spigot() returns an instance already so you wouldnt need a hashtag
because it manage all data sync (is a servercore) and it provide dependecies for other plugins if it goes out it will cause a lot of problems
Right but you don't just want to shut the server down
ah it will'nt call all "onDisable" for other plugins?
yes
doing the server a favor
Because you're shutting the server down completely
Uh that's the same thing lol
about yourself
/stop call onDIsable for other plugins no?
it would call onDisable for /stop yes
shutdown will most likely also call ondisable
that's what I want, stop the server
(all plugins)
when you said will'nt it most likely confused him
I mean I guess if that's what you want then go for it but not adviced
the negative for will is wont
sorry my english is bad
retroop the motivational speaker
Trooper is great
Even tells me to have more confidence in my ideas during tutoring kek
that I want is just stoping the server nomally (by calling onDiasble# for all plugins)
cuz it's the only other thing that isn't protocol lib or protocol support
and it's very well-written
You should be able to just do the Bukkit.getServer.shutdown method (if that's what you want)
like I love that it uses ByteBufs directly
yes I that 🙂
Then go for it
should work fine
Shutting the server down should as a result call all plugins onDisable methods
No worries man
imagine thread a writes to a heap allocated variable, then thread b reads it, even though b happens after a, thread b might still read the old value of a
making that variable volatile makes all writes visible to other threads
it has a performance penalty bt it just works
field access is stupidly fast
0.25-0.5 ns
so 100 times slower
25-50 ns
depends on a lot of things
still fast af
How do I get a player object from an offline player
OfflinePlater:::getPlayer
yes but how do I get the OfflinePlayer from a name?
I have an idea (very long way around) but I feel like theres a simpler way to do it
iirc Bukkit.getPlayer() takes a string too
You can't get a Player Object if the payer is not online
including offline players?
Oh not if they are offline
then whats the solution for it
Offline players don't have a player object
or whats the way
getOfflinePlayer
so you can't get it
tried it, didnt work
Bukkit.getOfflinePlayer().getPlayer();
I already told you, there is NO Player object if the player is not online
OfflinePlayer doesn't have a .isOnline method does it?
I wouldn't imagine so but hey
Maybe it does kek
what are you trying to do
this sounds like an xy issue
It does
how do i get rid of the 'Unknown Map' part in the lore of a filled map item?
Current Code:
ItemStack item = new ItemStack(Material.FILLED_MAP);
ItemMeta meta = item.getItemMeta();
meta.setDisplayName(ChatColor.translateAlternateColorCodes('&', "&7" + homeName));
ArrayList<String> lore = new ArrayList<>();
lore.add(ChatColor.translateAlternateColorCodes('&', "&bLeft Click &7to teleport to this location"));
lore.add(ChatColor.translateAlternateColorCodes('&', "&bRight Click &7to manage this home"));
lore.add(ChatColor.translateAlternateColorCodes('&', "&b "));
lore.add(ChatColor.translateAlternateColorCodes('&', "&bX: &7" + location.getBlockX() + ", &bY: &7" + location.getBlockY() + ", &bZ: &7" + location.getBlockZ()));
lore.add(ChatColor.translateAlternateColorCodes('&', "&bWorld: &7" + location.getWorld().getName()));
meta.setLore(lore);
item.setItemMeta(meta);
That's kinda goofy lol
If ChatColor.RESET is not considered a valid color any longer...if I use ChatColor.ITALIC, how do I reset back to non-italicized text within a formatted string?
It's still valid
You could also do ChatColor#translateAlternateColorCodes if you don't want colors to be that hardcoded
It seems that whenever I use it in 1.21, I get an error about invalid color name: reset in the console. Is there a different reason for that?
Show your code
var formattedComponent = new ComponentBuilder("[")
.append(Character.toString(range.toUpperCase().toCharArray()[0]))
.color(GetRangeColor(range).asBungee())
.append("] ")
.color(net.md_5.bungee.api.ChatColor.RESET).append(CreateNameHoverComponent(player))
.append(": ", ComponentBuilder.FormatRetention.NONE)
.color(net.md_5.bungee.api.ChatColor.RESET);
[...]
var finalComponent = formattedComponent.create();
SendRangedMessage(player, finalComponent, formattedMsg, radius);
Ith you're using the wrong chat color import
no
I tried both
There is no need to use reset in components
I've had bungee break my colors before so I wasn't sure
Ah, it's just because of the componentbuilder then?
👍
thanks!
structure them correctly and you won't need it
Ah fuck
thanks
Can I pass data to my interceptor? I tried calling a static method on my main class on it and it gave me class not found issues
I really hate doing this but I believe this might work?
totem effect? like undying?
no, best you can do is custom model data for the totem
if you play the effect when holding a totem, it will use that totem in the animation, else just a default totem
but it can only be a totem
Well if you want to replicate it closely, you could use an event listener to listen for when a player dies, if they're holding the item, cancel the event, give the player fire res, and add some particles.
sure you can fake undying, but you cant just play the animation with whatever item you want, I actually tried and found out today
if you do find a way please let me know haha
Running into a fairly weird issue with a gun plugin I'm working on
I'm trying to emulate gun recoil by quickly setting the playerWalkSpeed up and back down after 1 tick. This should have the intended effect of zooming out then back in quickly
However, some shots decide to zoom in rather than out and I can't figure out why
(The recoil is extremely strong in this clip to display the bug)
The code i'm using to change walk speed (This is called everytime the gun shoots)
Ideally I'd want it to zoom out every time but it's toggling between zoomout and zoomin randomly
Here's a possibilty. If you really wanted to try, you can set an item display to spawn in the player and zoom forward in front of the player like a totem.
yeah could emulate the effect I guess
@unique spade so the player slows when it fires?
No they should be sped up to increase the FOV right?
no the intention is to simulate gun recoil every shot, so a quick zoomout/zoomin
is it individual clicks?
try like 10 ticks and see if you get the same random zoom direction
Even weirder
sometimes the FOV just doesn't apply, sometimes it does two quick zooms which is very odd
walkspeed for changing FOV has been weirdly unreliable so I'm not sure how to fix it, unless there's an easier way to do that quick zoom
setting the player to sprinting has been consistent but it's not configurable which I'd prefer for different guns and everything
I think the idea of the walk speed is flawed in that it can cause that burst of speed we saw in the clip
I think it is possible to change a player's FOV without changing their walking speed using the Update Attributes packet.
((CraftPlayer) all).getHandle().b.sendPacket(packet);```
Also import ServerPlayer and do something like:
ServerPlayer serverPlayer = craftPlayer.getHandle();
ServerGamePacketListenerImpl listener = serverPlayer.connection;
ClientboundUpdateAttributesPacket updateAttributesPacket = new ClientboundUpdateAttributesPacket(player.getEntityId(), );
listener.send(updateAttributesPacket);```
In implementation it would be minimal, it's just heavily boosted here to see the zoom bug
ooo
Would this work fast enough for the quick zoom?
Most likely. Changing it would be something like:
this.attribute = var0;
this.onDirty = var1;
this.baseValue = var0.getDefaultValue();
}```
I'm not sure, though.
Something you could try.
I'll go for it
I wanted get some help with a custom crafting plugin I'm working on. I'm trying to make a custom crafting menu, kind of like hypixel skyblock's crafting menu, but for binding spells to a wand. I've ran into some weird problems. Right click works for saving items in input slots, but left click doesn't. I don't know how to fix it.
I also don't know if handleCrafting is the best way to approach a generalized system.
- You should really stop with all those for loops and use Maps instead.
- MetaDataValues are an old artifact from the past and almost never the way to go.
Try to explain what you mean by "Right click works for saving items in input slots, but left click doesn't"
Use attribute modifiers and leave the players walk speed alone.
Those can be identified via UUID and reduce the chance of you messing up the players default walk speed.
namespace key now*
Yes, so if I right click on the input slots, the item is saved to that slot’s item attribute. So when I close the inventory it goes back in my inventory and other stuff. But not for left click. Left clicking on the slot doesn’t work.
Nice, the UUID+String combo was so weird
Yeah
What do you mean by "doesn’t work". What do you expect to happen and what is actually happening?
What I expect to happen is: the inputSlot.getItem() returns the item in question. When I close the inventory it should go back in my inventory. I can left click. It goes in the slot. The slot doesn’t save the value
Slots cant save arbitrary values. Im still confused.
There is an Input Class and an Output class as well as a Menu and Crafting Menu class.
Alright, im seeing a few fragile breaking points here that can lead a ton of problems.
But i kinda get the idea.
So your updateItem() method doesnt result in the Output item being updated properly when you leftclick the output slot, is that right?
what is the best plugin to patch server exploits?
Updating your server to the latest version
that's it?
But if i use the old mc version, what is the best option for me? XD
Hello guys how can i check Enchantment is correct in 1.21. I used Enchantment.getByName("UNBREAKING") but it is depracted now. I think i need to use Registry.ENCHANTMENT.get(NamespacedKey) or something like that anyone can give me example pls.
Yes!
Tried this and it fixes the zoom issues, but is fairly inconsistent on whether or not the FOV will change
Chat is showing the current movement speed modifier
Could it be how fast the attribute is changing? it may just be that it's all happening within 2 ticks

fun fact: Today I used bytebuddy to redefine FileConfiguration to never save in the main thread
muahahahaha!

I have noble reasons
doubt
Obfuscated plugin was laggin the entire server
I did have to do something really cursed to filter what plugins could save in the main thread
Ah thats a valid case. I was wondering why you used FileConfiguration in the first place.
(I scanned jar files and mapped every possible class name to what plugin defined it)
My solution would be to nuke the plugin
(because I was having class loading issues)
It only lags the entire server really hard once!
Can I hire a developer?
?services
If you wish to request or offer development/art/building/administration services, please do so at https://www.spigotmc.org/forums/services-recruitment-v2.54/
Yeah its a mess to work with
The new code inspeaction for printStackTrace bothers me a lot.
Pass System.out to the method call.
the one annoying thing of working with bytebuddy is that for some ungodly reason I had to make my interceptor method static
Like if I just made a regular method it'd trip out
but if I made it static it was ok
which lead me to some awful static abuse
And some cursed shit because my main class could not be found
Ok? Did you forget to pass an instace to the method invocation?
public void intercept(@This FileConfiguration config, File file) {
...
}
causes errors
Wait your interceptor method for injection??
Not that
In short I wanted to pass my own little SettingsFile instance because like
I have a collection of plugin names to check for
But some wonky classloading issues I don't know about (it's like my first time messing with class loading) caused a bunch of NPEs and such
Constructor injection doesn't work because bytebuddy is ass and different classloaders yada yada
A static setSettings method caused NPEs
Ah yeah the spigot classloader can cause problems
So I had to yeet SettingsFile and all its dependencies to bukkit's classloader
And then get my own plugin through the plugin manager, cast it to a generic JavaPlugin and load the config from there
lots of yeeting to another classloader
I might reuse the reloading strategy but wtever
And then yeah figuring out what plugin called the save method is the slightly simpler part
Get stack trace, skip some stuff, get the plugin that defines the class and beep boop
At that point i feel like hate mails to the original dev would have resulted in faster results
these are heavily obfuscated plugins with a wacky licensing system from a premade server setup
solid chance it's just a fork of something public with 2 lines changed
or an extra placeholder

But hey now I'm 40$ richer and can claim I have bytebuddy in my tech stack
That's like.. a date or a gym membership or 25 packs of doritos
Another thing that will ruin your night:
I have a second project that needs me to use kotlin

It's a discord bot

For a service team
(bukkit related) project ideas?
use bytebuddy to make minecraft async
Whole server or just a plugin`?
We all know which one of those is the most likely
It's also about 35 liters of energy drink
plugin (if this was for me anyways)
I bought some last night
But why energy drinks?
Pretty sure if you drink it all in one go you have a caffeine overdose
That looks like stale urine
^
Dont do that, not a fun experience. Had unfun with a pre workout they sent me as a sample with my protein. Was about 7 years ago.
Was awake and sweating for 2 days and felt like sh**t afterwards. No idea what they sent me, but i never touched anything more than
a coffee after that.
I'm aware, internet friend of mine tried ending it all with caffeine
Woke up in the floor 17 hours later fully covered in sweat
What in the hell
That is an astonishingly stupid idea
In multiple ways
Cmon guys I can't be the only uncreative one here!
If you were we’d all have ideas for you
Not a topic i wanna expand on, but it would take hours, give you the migranes of your life, youll feel like your eyes will pop and your heart is
exploding in your chest. Full on panic for hours till your heart/lungs fail.
Absolutely stupid
I can't argue with that D:
A server idea or for a plugin?
Game mechanics, utilities, vanilla expansion? Or doesnt matter.
I like vanilla expansion
QOL has been on my tdl for a while I just don't know what would be QOL (that hasn't been done already anyway)
But then you run into custom blocks / entities being a pain :(
Write a plugin which lets the player swap to the most suitable tool in his inventory depending on what he is breaking right now.
PlayerInteractEvent -> scan inv for best item -> swap to main hand
Do all blocks have tags?
There is a method which tells you the break speed as a float for an ItemStack and a specific block.
Just select the one with the highest break speed float.
I think I'd use both of these things no? I mean tags to determine which kind of tool, and the break speed to determine the fastest of said tools (in case of enchants + multiple tools yeah?)
Hmmeh
Depends on how expensive the break speed calculation is but i would just do one pass
And maybe not scan the entire inv but only the toolbar
yeah let me mess around real quick
action != Action.LEFT_CLICK_BLOCK
Does left click block always result in the breaking of a block?
Nope
Not if it’s an unbreakable block
cloud my beloved
anyone know of any tools which take base64 > skin png?
Ok well that's done lol what's up next
how awake
Awake but working
ohh
How to set Skeleton reload time?
new BukkitRunnable() {
@Override
public void run() {
skeleton.setArrowCooldown(0);
}
}.runTaskTimer(Plugin.INSTANCE, 0, 5L);
It doesn't work
people saying ai is a bubble because there is no real application are high on some kind of copium
I'm so lazy that even though I just added a paragraph to my wiki I'm having the ai retranslate the entire page to all my supported languages
and there are long pages
I feel people who say that are largely non-tech people
my only regret is that it's too slow and too expensive
like at this point if you are not using AI to help you code, you are wasting time
both problems which very much are getting improved on on a weekly basis
also man gemini pro 1.5 is popping off, it's now translating better than chatgpt
by a mile
is it possible to anyhow override how every item lore(including enchants etc. , idk how its called correctly) is displayed
you can hide enchants and add custom lore that looks like enchants
using packets you could do it pretty easily if you don't want to manually change every itemstack you come across
but still a big job either way
i dont care im bored anyways, so id need nms for this i assume
you could use a library like packet events
we love censorship
gemini refuses to translate the word "dead"
when literally just in a list of adjectives
Lmao
We can go with bubble. They just dont understand its a really large empty bubble currently.
actually
I think it's getting stuck on translating the word black to spanish because that's 'negro' and someone forgot their AI is supposed to be multilingual
very smart very good idea
Lmao
trust me it's not easy to have an ai that is well censored and that doesn't impact people little mind
huh I was browsing the support forum for google gemini and it seems like the korean word for 'design' is also hard censored
oh it's also getting blocked in random latin words too
fantastic system, 10/10
leave some time to progress, it's been really fast these two last years
this is not an ai problem
it's a manual filter put in place by google
it bypasses the ai system
But if you remove it many people will complain about the ai
and if you don't it makes it unusable in portuguese and spanish
and korean and latin according to the feedback page I was reading
remembering the polemic around gemini with the little biais, i understand why they decided to temporarely put a shitty filter on it
people will use any occasion to put a finger on technology
without even understanding that they are the cause of it (ai reflect the humanity biais on many topics)
If you want to use this technology right now, I advise you to run some open models locally
Hey guys, i am currently developing in Paper for MC 1.21. I was seeing that the ChatColor classes are completly deprecated. What to use instead to Color a text ?
hey all im working on a spigot 1.20.1 but im looking for a plugin so i can sell my worldguard regions. i tried areashop but i cant find a version for 1.20.1
?whereami
😂
You guys seem to be so triggered when asking a paper question here...
Well that question is paper specific
They are not deprecated in Spigot
you have to use Components
Well this isn't paper discord
they have their own for a reason
he asked there I see
good -.-
org.bukkit.plugin.InvalidPluginException: java.lang.UnsupportedClassVersionError: test/pikachu/Pikachu has been compiled by a more recent version of the Java Runtime (class file version 60.0), this version of the Java Runtime only recognizes class file versions up to 52.0
what does that mean
I think is because the java version
Yeag
Means the plugin has been compiled against a newer java version than the server is running on
🗣️
Hey, do you think that I should relocate all my libraries into my project's folder?
Okay, I admit it, I was very vague haha. I mean my Maven dependencies, such as net.kyori and co.aikar, etc
oh, well it depends
like some plugins you might not wanna shade
but libraries are usually okay
or relocate I mean
tysm
people are going to complain anyway
if its an actual library it is generally recommended to relocate them for projects that are plugins and not actual applications. It avoids causing conflicts with another plugin that may have the same library but a different version
@Override
public void showEntity(Player... players){
Bukkit.broadcastMessage("SHOW ENTITY " + players.length);
for(Player player : players){
Bukkit.broadcastMessage(player.getDisplayName());
}
EnumSet<ClientboundPlayerInfoUpdatePacket.Action> actions = EnumSet.noneOf(ClientboundPlayerInfoUpdatePacket.Action.class);
actions.add(ClientboundPlayerInfoUpdatePacket.Action.ADD_PLAYER);
actions.add(ClientboundPlayerInfoUpdatePacket.Action.UPDATE_DISPLAY_NAME);
ClientboundPlayerInfoUpdatePacket playerInfoPacket = new ClientboundPlayerInfoUpdatePacket(actions, Collections.singletonList(this));
ServerEntity serverEntity = new ServerEntity(this.serverLevel(), this, 0, false, _ -> {}, Set.of());
ClientboundAddEntityPacket addEntityPacket = new ClientboundAddEntityPacket(this, serverEntity);
asEntity().refreshEntityData(this);
ClientboundSetEntityDataPacket entityDataPacket = new ClientboundSetEntityDataPacket(asEntity().getBukkitEntity().getEntityId(), asEntity().getEntityData().getNonDefaultValues());
PacketUtils.sendPacket(playerInfoPacket, players);
PacketUtils.sendPacket(addEntityPacket, players);
PacketUtils.sendPacket(entityDataPacket, players);
}
Heyo I'm getting a failed to encode set_entity_data packet for the following code.
I only get it when theres 2 players online, and only ever on one client at a time. How do I properly get the data?
Also I've noticed the entity data will only load properly on the second npc spawned unless i packDirty() which i assume isn't the correct way of doing it?
but the server is 1.8.8 though
[18:18:53 INFO]: Starting minecraft server version 1.8.8
Java
You'll need to find a fork that's up to date enough to support Java 16 or more likely java 17
a fork?
sucks for you I guess
There are plenty of 1.8 forks
so i gotta upgrade my server version
That's not what I said
but yes that's also an option
The better option infact :)
but my plugin is 1.8.8 would that be a problem tho?
all 1.8 forks fork 1.8.8
if they don't they're stupid
anyone using 1.8.8 at this point is questionable anyways
I think he asked for an upgraded server version
Updated server for 1.8.8
this tbh
it is recommended to do so yes, however the real issue is that your java version is out of date. I don't remember if 1.8.8 can run on java version past 12 due to some changes in reflection and the sorts
but if you don't have a reason to be using mc 1.8.8, then upgrade both your server and java
well im developing for kitpvp server so well i gotta use 1.8 since there are better weapon system
and hit cooldown ep
but how can i skip that error without changing my server version or plugin version
alpaca desde cuando llevas en java
desde que tenía 12 años
btw who are you
just a spigot discord user xd
english or spanish
man I'm from Spain
Quien hable primero en este canal es gay.
you just did it
How do i use a anvilinventory and get the name a player renamed something to in the inventory?
with pain
theres an unwritten rule of first guy who did it doesnt count
either use packets or a library that does it for you
(hard to explain tho)
ye i know but i do want to do it but i just can't find out how
You need a bit of NMS
i do have a reason for that
so how can i skip the error without changing my server version or plugin version
can't
You could use my library and bukkit events or AnvilGUI
https://github.com/Y2Kwastaken/OpenMe you can also try this
Coll beat me to the plug :P
You have to pay me for advertising
1 penny to you
Yeah you should be their Marketing manager
We don’t even use pennies anymore :(
:( I wish I could say the same
I haven't touched cash in like over a year now >>
I wonder how much in charity is done each year because people just throw their pennies into donation bins
not as much as you might think lol
people in the US would go crazy if that was implemented
My freedom of... pennies?
you don't like pennies?
No I'll usually throw em into donation
I cbf to hold onto them
The rest of my coins I throw in my piggy bank and take em to the bank once a year
personally I am in favor of currency just being digital
there isn't really any value of having money in cash form anymore
strip clubs
I only use cash if I don't want my transaction to be traced
Pretty much only 18+ things I use cash for kekw
I mean they could just implement their own currency that you exchange for
if you really need to throw some cloths around
The view one
Yeah
btw why is my plugin 1.8.8 and my server is also 1.8.8
but one is java 8 one is java 16
I really want machine to review it
So he doesn't endlessly complain if he doesn't like something
👀
idk what you are talking about, but plugin version numbers do not need to match the server version number
If someone made a plugin for 1.8 but compiled it with java 16
That’s just them being silly
well what i am trying to say is
plugin and the server is both 1.8.8
but their java version are differnet
ehm i acutally successfully loaded my 1.8.8 plugin on 1.8 server
obviously this alpaca person is insistent on not wanting to change their server version and doesn't appear to like the responses lol
Tends to be this way with people who insist on using legacy versions
sigh, what a shame for these people to live in the past
and not know what they are missing out on
^
Still on your nerves 9 years later?
maybe one more year and 1.8 completely dies out
X to doubt
only took like 8 years for it to be at less then 5%
sigh, what a shame of unknowledgeable thorugh for anyone's pvp experinece
💀
If only there was a plugin for old combat mechanics
Doubt it the 1.8 people left tend to be the most vocal minority
its just spam clicking in 1.8
old combat is goated
not sure what experience you are talking about o.O
1.8 will exist as long as there are 12 year olds with adhd that wanna click fast
hypixel's serve player:
You also have to move left and right
Maybe we could call it OldCombatMechanics
hypixel's server player again:
Half of hypixel’s players are on skyblock
not sure what hypixel has anything to do with this
Which has custom combat anyway
How about... you actually write your own combat system.
Since 1.20.5 this is more viable than ever.
It also prevents almost all hack clients, as they are tailored to the vanilla combat system.
How to modify item durability bcs setDurability is depracted
Cast ItemMeta to Damageable
- Get the ItemMeta
- Cast it to Damageable
I still want that pr merged :(
good old times of me having the triple click mouse
surely a server that survived with 1.8.8 for over 9 years have nothing to do with 1.8.8
💀
And then .damage() method or something else?
Thats true, it doesnt. There is no correlation.
I think they don't update for reasons different from what you think lmao
I believe it’s setDamage
Yes
Make sure you use the right damagable import
Turns out when all your infrastructure is for a modified spigot from 1.7.10 it's hard to update
dude
Aren’t they planning to move part of skyblock to 1.20
who is "we both"
their forked version isn't even vanilla 1.8.8, no where close. It is very heavily modified. You are not running your own fork and maintaining it if you were you would not be here. However do know hypixel doesn't come here for support of their outdated server versions
which is what you are doing
Him and Simon they're different sides of the same coin you see
ah yup
There is no guarantee that they are running 1.8 btw.
They could as well have another backend version and simply translate the protocol.
If item is Unbreakable will it damage the item?
you also need to set max damage if the item has no vanilla durability
I think they run some weird modified 1.7.10
Yes it will change the durability
Who knows, only @worldly ingot :p
yeah they do
Yeah but imagine him spewing that and gettin his ass whipped with an NDA
mdma?
It's a drug
