#help-development
1 messages · Page 137 of 1
Yes you can do a simple mapping from ConfigurationSerializable to byte[] over String
So there has got to be a better way to check if a player has permissions to build in an area instead of spamming events. Like, This is a Ability plugin, and i CAN do those spammed Block Events, i just dont know if there is like an isClaimed method or something similar that i should be using instead. Because this seems like not a good way to deal with this
I can either check on Every event (which does not seem like a good idea as im creating thousands of events potentially) or i can check a flag. But i dont think there is an alternative
Like i COULD set the nesting loop so deep that the last thing it checks is the Build Perms, but again, Seems kinda Problematic
So you want to check if another plugin is restricting building for a certain player on a certain location for your abilities?
Yea, like i have a setting i want to implement that just prevents you from using an ability in an area thats claimed or whatever and the first thing that came to mind was building, if its claimed they cant build there, and im not trying to add 50+ plugins for api checks into my jar. But i dont think there is anything i can do other than blockchecks like i was doing in the linked message
But that seems like a poor implementation
Yes firing a BlockBreakEvent is the only reliable way.
There is no alternative so its the best possible implementation
Should not be an issue
Damn, Alright well Thanks for your input. Ill let you know if i end up doing anything else
How do I get this data from another class?
ItemStack i1 = new ItemStack(Material.DIAMOND);
i1.setAmount(16);
?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.
i am a bit confused on how to get all runes, surely there's no method to get all player's pdc entries?
public List<Rune> getRunes() {
return List.of(); // TODO Implement
}
public void addRune(final Rune rune) {
safePlayer().getPersistentDataContainer().set(getRuneKey(rune), Data.runeType, rune);
}
public void removeRune(final Rune rune) {
safePlayer().getPersistentDataContainer().remove(getRuneKey(rune));
}
public Rune getRune(final long id) {
return getRunes().stream().filter(rune -> rune.getId() == id).findFirst().orElse(null);
}
public ItemStack i1() {
ItemStack i1 = new ItemStack(Material.DIAMOND);
return i1;
}
I have the code above and I use it in two different classes, but I need this item to have a count of 16 in one of them and 1 in the other. How do I do this?
ItemStack has a constructor, which takes amount.
ehh debatable, you can do some things
public ItemStack getItem(int amount) { // taking amount as an argument
ItemStack i1 = new ItemStack(Material.DIAMOND, amount); // passing it into the constructor
return i1;
}
thx
take a look at the documentation once every while
better yet, every time you struggle
Well only reading. And even that results in undetermined behavior.
Not necessarily
You can, for example:
- Create itemstacks async, and set them into inventories (opening the inventory still needs to be done in sync)
- Do anything where the implementation is purely packet-based (send message, sendBlockDamage, sendSignData, sendBlockChange)
The only think you can safely do async is sending messages
There are also weird thread-safe workarounds, like ChunkSnapshots
maybe you can do all that, but if the documentation says you shouldn't, then reconsider
I would strongly discourage setting itemstacks in an inventory async. And the rest makes sense.
I was mainly referring to linked objects.
Setting items async is useful for stuff like heads, that might take some time to load
Specially when fetching profiles from mojang's api
Async yes. But not from a different thread.
Technically you can do everything async in spigot. But using a different thread is another story.
But even sending messages or BlockData from a different thread makes very little sense.
it's useful when you're already working on a concurrent environment
And how to add one item in the 1st class ItemMeta
For example, providing the outcome of an async operation
sure it's highly stupid to create a new thread just to send a message, but what if you're already doing heavy multithreading? Then it's just icing on the cake
... Vexor the stacktrace tells you the problem
literally the problem
go to help-server.
You sure it’s not release 50?
yes
What version are you compiling it with
mf plugin compiled in java 1 💀
i cant even send images
java 17
You’re not verified
wait
is a lil messed up
Can anyone tell me why I get “IntelliJ (JAVA): release version 5 not supported” error?
either should solve for you
ye that was it tysm
hm guys
setinvisable(true) < removes hitbox completly?
like it seems like no hitbox at all
i think its just for the client
like it shows it like that
if its a zombie or sth and not marker armor stand
i dont use market
nvm wierd location of hitbox as well
my check didnt work
ill find out why tho
setMarker is such a weird api concept because markers have a different entity type id in the registry
how do i set no gravity using nms?
it is there
maybe the EntityType is diff
so that armorstand is no longer ArmorStand?
afterwards i set it invisable?
how to you have it not obfuscated?
mappings
im trying to figure out how to do that, no beans yet
maven or gradle?
maven
fuuuuck
im having to use the mapping website and do it from there
Hello, I'm trying to find a way to shoot an arrow from a block to a targets head, the problem is that the arrow doesn't always reach the target if he is too far. I need to find a way to increase the arrows angle it is being shot at depending on the players distance although I don't really know the math for this and I was wondering if someone could help me out. Here's the code I've written which works a little but isn't very accurate because it doesn't always hit the targets head : https://pastebin.com/SFChCC9Q
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
so you want homing arrows type deal
you can just re-angle the arrow every tick to counter gravity and all
I'm doing something like that in my code, but it isn't very accurate
Or just increase velocity accordingly, worst case is just setting no gravity on the arrow lol
That wouldn't look realistic though
Maybe this helps
anyone have any clue how i can detect if player Interact or get in touch in anyway with invisable armorstand, things i tried PlayerArmorStandManipulateEvent,PlayerInteractEvent,EntityDamageEntityEvent
but none of them actually even passed thru check
like there no entity
so I did all of that, but updated it to 1.19.2.
The last time I did this with a weird packet trickery, but this shouldn't be needed here. Lemme think
no beans
Well maybe the client doesn't interact with an invisible armorstand
So there may not be a way for you to find out
hmmm r u sure?
like
HD did it
some ohw
using packets
and they catch that packet
that client actually send when he click it
i create as well an real entity
and set it invisable
but concept is ew ew
xd
Well what comes to mind is absolute brain-dead, but you could get when he hits air, raytrace and see if the entity is in the way
And no packets there hopefully
NMS, Les goooo
i feel like i imported nms wrong and im just stuck with obfuscation
intellij
may i slide by and request help: https://www.spigotmc.org/threads/fetch-all-persistent-data-from-a-player.573663/
you may
nah man
thats such a headache for god sake
ill just set marker false
and summon an invsibe bat as hitbox
bruh
thanks, i did
No clue sorry
np, maybe someone else stumbles upon this
nah man i dont want to summon anoher ticking entity so badly
bruh
it will be x2 shit
like disabling the AI using nms is not big deal
Umm can someone help me ? basically i did everything correctly i added config.yml in resources and i added getConfig().options().copyDefaults(true); to my onEnable method and basically my default config is not creating
you need to create the yml first
well yeah but also create the folder in the method as well
saveDefaultConfig()
Use that
uhm yeah good one i probably deleted it by accident
Dont use options.copydewfaults. Use saveDefaultConfig()
but thats not deleting it
using saveDefaultConfig() creates the folder for you
it will not delete an already existing config
exact
then delete it
but dont i want to copy defaults that i have set in IDE ?
if you reset everything to default and want to overwrite teh file you have to call saveConfig()
Hi, i have a problem... When i make this, it's open a crafting table to the player ( good ) but i can't make any craft in
porky?
Crafting logic requires an actual table
So I can’t craft with a portable craft table ( in my GUI ) ?
try p.openWorkbench
also nice ide theme
not unless you manually handle the recipes I believe.
how do i get index of object from set ?
i don't understand whats the force is
in the p.openworkbench
true if there is no Table at teh location
perfect its working 🙂
Why? Sets are not index based.
thanks
then ill convert it to array ig
Why do you want an index?
because i have some player names set in set and i want to put each name of player on different item in gui and i want to make it so index in set is slot in gui
when i say gui i mean inventory yk
read the docs
you only need loop over the Set
yep ty
i am looping through the set and im gathering string as player name but i dont know how to get index of that string that is gathered from set
You don;t need an index. its irrelevant.
the Set is a Collection of names. Their "index" shoudl have no relation to your GUI
list.setItem()
is part where i want to put slot, itemstack
why not just have some counter
i can use old int i = 0; method
but then i would need to make one rewrite kind of
Either use a counter or completely ignore teh index as you are simply adding them to an Inventory
i would need to save set to variable for easier usge prob
welp yeah or else use toArray and work with it as array
ksksks
You don;t need an index at all
i dont need but i think it is cool
why? You are just pushing them all to the Inventory in no order
Index makes no difference
show me
why not just additem
managed to do it this way so agh idk
i used old int i method
ifykwm
seen some recently, but they are off right now
((
(
correct
come general 1
why so
wasnt aware we had more than one channel with that name
👀
i honestly dont know why they dont allow screensharing... here
I have three teams redPlayers, greenPlayers and bluePlayers (bluePlayers are yellow, but I didn't change it) and I wont set colors and prefixes. I use this code
public void setOption() { redPlayers.setColor(ChatColor.RED); greenPlayers.setColor(ChatColor.GREEN); bluePlayers.setColor(ChatColor.YELLOW); redPlayers.setOption(Team.Option.COLLISION_RULE, Team.OptionStatus.NEVER); bluePlayers.setOption(Team.Option.COLLISION_RULE, Team.OptionStatus.NEVER); greenPlayers.setOption(Team.Option.COLLISION_RULE, Team.OptionStatus.NEVER); redPlayers.setPrefix(net.md_5.bungee.api.ChatColor.translateAlternateColorCodes('&', "&f[&c&lRED&r&f]")); greenPlayers.setPrefix(net.md_5.bungee.api.ChatColor.translateAlternateColorCodes('&', "&f[&a&lGREEN&r&f]")); bluePlayers.setPrefix(net.md_5.bungee.api.ChatColor.translateAlternateColorCodes('&', "&f[&e&lYELLOW&r&f]")); }
in my team class and then I am calling this method in Command.
but after this command nothing change. Can someone help me?
What are you expecting to change?
colors of nicknames
Have you set ALL players to the same Scoreboard? and Set the team for each player?
yes I am registering all teams to same scoreboard and I am testing colors on me, so I am only in team
Where are you expecting these colors to change? They show in Tab
yes, I am expecting it in tab
You will have to show some code as I know team colors work just fine
this is my scoreboard class in which I am registering teams: https://pastebin.com/WAx7DeAB
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
line 52 you create a new scoreboard every time this method is called org.bukkit.scoreboard.Scoreboard b = m.getNewScoreboard();
yes, but this scoreboard work fine, this isn't scoreboard in which I register teams. I register teams in class scope
You shoudl be using the one scoreboard not creating a new one every time
use board you created at class instancing
and will it update lines?
everytime you call update you are creating a new scoreboard and setting the player to it
ALL players must be on the same scoreboard. You are just creating a new board every update
ok, I will try it, but Idk if I will need more help
Can I somehow make XP orb take float?
no
bruh why is that
because ALL exp is an integer
player.getExp() returns float tho?
thats a percentage. its not a value
ah
int getTotalExperience()
how can i show the player that elder guardian effect when you get nearby an ocen tempel
that
is there a way to force that
give em mining fatigue then remove it
that works?
keep in mind to remove, give, remove, and give back the effect with the duration it had before if they already have it
otherwise the animation wont shot
show
well yes
ok duh
but the issue here is that if they have that effect already
you need to remove it to replay the animation
otherwise you just change the duration
Can i somehow get orbs spawned in xp bottle event?
No there are no orbs
dang
so exp bottle just spawns orb amount equal to the XP?
The effect you see is just a particle effect
you can disable the effect in the event and you'll still get the exp
You helped me, colors are now showing, but I need some way to update scoreboard
orb is an entity tho
call setShowEffect(false) and you will see
bruh its a shame we cant make individual ones unstackable
You shoudl be able to
like i get it that u can change it in spigot config
i dunno how to
posts on forum also didnt help
btw i tried making their meta unique
I know you can prevent all orbs from merging
well in server config
yes
have you tried monitoring the event https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/entity/ItemMergeEvent.html
cancel it if its an exp orb
or cancel it if its an exp orb with your meta
how can I update scoreboard which is in class scope?
How can i block a player from dropping a item from his tool bar but not by dropping from the open invetory?
use the drop event check if the player has an inventory open
listen to the drop event and cancel it if the player doesn;t have an open inventory
How can i check if a player has his inventory open?
doesnt trigger for XP
It can't return null i already triend using it
ah not != null, check if its teh correct view
can you send me an example?
it doesn't work
?notworking
"Does not working" is a useless statement. Please describe what exactly is not working, what you expect it to do, and what actually happens. If you get any console errors, also ?paste the entire stacktrace.
it can't "not work"
this is the code, probably i done it wrong
if (player.getOpenInventory().getType() != InventoryType.PLAYER || (player.getOpenInventory().getType() != InventoryType.CREATIVE)) {
if (player.getOpenInventory().getType() != null) {
event.setCancelled(true);
return;
}
event.setCancelled(true);
if (!event.getItemDrop().getItemStack().getItemMeta().getDisplayName().contains("4")) {```
does anyone have a method to reflect a direction?
like pointing with a laserpointer into a mirror?
or the maths for it?
I do not see a sysout in there anywhere
isnt that just the exact same angle from the point of the mirror?
just the other way
add a sysout in teh drop event and see what type it is when dropping from an open inventory and when dropping with no inventory open
well i didnt thought of just changing the angle, will try lmao
yea it is a rare occurrence isnt it haha
So here is a PSA to all Devs who piss around with crop modifiers in your servers. Spiggot's been borked when it comes to positive modifiers for years (X axis, ignore it being cursed lol, is the growth modifier in the spiggot.yml, y axis is the growth chance for crops in game for f = 5).
And it seems this has been a problem for ... erm... a while haha https://www.reddit.com/r/admincraft/comments/1prpkc/crop_growth_modifier/
I am trying to refresh scoreboard, and I am using this updatePerLine()
public void updatePerLine(Player player, String line, int scoreSlot) { if (!Bukkit.getOnlinePlayers().contains(player) || (player.getScoreboard() == null)) { return; } for (String str : player.getScoreboard().getEntries()) { if (str.contains(line) || str.equals(line)) { player.getScoreboard().resetScores(str); } } org.bukkit.scoreboard.Scoreboard score = player.getScoreboard(); score.getObjective(DisplaySlot.SIDEBAR).getScore(line).setScore(scoreSlot); }
But it don!t update my scoreboard. Here is my class: https://pastebin.com/Y7asLvWv
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
So for context, upping carrot growth modifier to 260 would have the same effect as 450 💀
What is cousing this error https://pastebin.com/fpA0bDLT
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
?
KillEvent line 21
@EventHandler
public void onKill(PlayerDeathEvent event) {
Player killer = event.getEntity().getKiller();
if (killer != null) {
EconomyResponse eco = ChaosKitPvP.getEconomy().depositPlayer(killer, 300);
if (eco.transactionSuccess()) {
killer.sendMessage("§8» §aHai ricevuto 300$ per aver ucciso " + event.getEntity().getPlayer().getDisplayName());
killer.sendTitle("§a§l+1 Kill", "§7Hai ucciso " + event.getEntity().getPlayer().getDisplayName());
killer.playSound(killer.getLocation(), Sound.ORB_PICKUP, 1, 2);
killer.addPotionEffect(new PotionEffect(PotionEffectType.REGENERATION, 5, 4));;
} else {
killer.sendMessage("§ala modanna toria è esplosa. MOTIVO %s!" + eco.errorMessage);
}
}
}
}```
and what is line 21?
EconomyResponse eco = ChaosKitPvP.getEconomy().depositPlayer(killer, 300);
getEconomy() probably returns null
ok
did you add Vault as depend: or softdepend: in plugin.yml?
No it didn' t work either
then ?paste your getEconomy method pls
?paste
hey alex, do you have suggestions on how to improve this? e.g. I want to use ItemStack#deserialize if possible, but not sure where to get the Map<String, Object>
public static Rune deserialize(Map<String, Object> map) {
Object objectifiedStatistics = map.get("statistics");
if (!(objectifiedStatistics instanceof List<?> statisticsList)) return null;
if (statisticsList.stream().anyMatch(o -> !(o instanceof RuneStatistic))) return null;
List<RuneStatistic> statistics = (List<RuneStatistic>) statisticsList;
// Deserialize itemstack
Object objectifiedHeadItem = map.get("headItem");
if (!(objectifiedHeadItem instanceof ItemStack headItem)) return null;
return Rune.builder()
.statistics(statistics)
.runeTier((int) map.get("runeTier"))
.headItem(headItem)
.id((long) map.get("id"))
.build();
}
I see. you probably try to get the economy thing before it got registered
just for fun, call "setupEconomy" right before you call getEconomy()
if it works now, we know what the issue is
stupid question, but do you even have any economy plugin installed?
the setupEconomy should fail if they don't
anyone can help me with a custom gui background ?
you cannot get a Map<String,Object> from the config directly, you have to translate it yourself, e.g. like this (1 sec, link incoming)
?ask
If you have a question, please just ask it. Don't look for staff or topic experts. Don't ask to ask or ask if people are awake or available. Just ask the question to the channel straight out, and wait patiently for a reply. Make sure you use the right channel regarding the topic of your question. Create a thread in case the channel is already in use!
sneakily copied
I want to make a custom gui background with eclipse and i dont know if it's possible ?
elaborate on gui background?
^
btw alex,, is there anything else that could be improved in my deserialize method?
for exemple when you do /menu that open a new inv
yes i have it
looks fine to me, except that you ignore the return value of "headItem"
.headItem(headItem)
then please try what I said above and add "setupEconomy()" in the top of your "getEconomy()" method
oh nvm, I didnt see that
😛
I did it
and? still doesn't work?
Nope
Hello, so I have a bungee cord server, and I do not want to make proxy plugin. (for reasons that I'd like you to spare me from explaining)
Instead I rather prefer add a (spigot) plugin in every server of the network.
I implemented chat system through plugin messaging. it works very well, but i feel like this system could be abused. (e.g if a player's client receives the message and manages to modify it before the event pluginmessagereceivedevent triggers, etc) + it requires a player as sender (connection) and a player as receiver (connection)
Is there a way to use the bungee api somehow from the spigot plugins? (I found https://github.com/leonardosnt/BungeeChannelApi which seems good enough for what I want to do, but i guess it uses the same exploitable plugin messaging than what i'm already doing anyway ?)
okay, then add debug messages to setupEconomy().
E.g. currently you do stuff like
if(rsp == null) {
return null;
In this case, make it print out "rsp is null" and stuff like that
so you know where exactly it fails
add a System.out.println before EVERY return statement
Question how do i link servers like hypixel? Like add multiple servers sending info?
exploitable? How are plugin messages "exploitable"?
ik learnjava but why is that null. i legit forgot how that works like tf
ConfigurationSection section = (ConfigurationSection) map.get("headItem");
Map<String, Object> deserializable = asMap(section);
ItemStack headItem = ItemStack.deserialize(deserializable);
is this good? yaml syntax:
runes:
'1663497318719':
# we are working here
headItem:
# itemstack shit
I have velocity, but what i am asking is like how can i connect the data between each server? With mysql?
you start counting from 0, it's args[0]
what exactly is null? Please show the full stacktrace
oh, you cannot. Every plugin has to take care of that itself
Ah so there is not a system or something to connect the data between each server and getting it linked?
thanks 💀
some plugins use mysql for this, others are smart and use the player's PDC, some other plugins cannot do that and use redis instead, etc etc etc
well, there isn't a system that magically knows what data to fetch
Nope, it's simply not possible for "all" plugins
^
Yeah I understood what you mean
Thank you!
np
sorry for this answer but yeah, it's just not possible
hypixel made all their own plugins in mind with bungee support
how to get the 1.8.8R3
buildtoosl
I kinda knew, that basically we need velocity and code all our plugins by ourself
this time you were faster lol
but you were more accurate
I just said the same thing lol
😛
Question on a subject, we are removing all the plugins and we are making it custom, is it possible to take a data of a public plugin example an economy and introduce it into our own plugin. In order to remove the free plugin?
@prisma leaf no friend requests pls, and no DMs pls
you can ask here
friend requests are only allowed from "friends", hence the name 😛
hi, i coded it so you cant pick up the dragon egg with your cursor, only with hotkeys, but if i hotkey the item in a chest or any container i can pick it up...
how do i fix that?
It all depends on the Plugins license
I dont understand this question at all
Well, i know we can manually decode the data from mysql so we can like import it into our own
oh maybe i didn't understand how the system works then.
For me it was this, tell me if i'm wrong:
PluginA takes player1, as the sender.
PluginA sends a plugin-message from player1 on channel69.
player2 (from ServerB, PluginB) receives the message. At this point I suppose that if player2 had a client that modifies the message they receive/pretend they received a different message.
player2 informs PluginB that they received a message.
PluginB triggers the onPluginMessageReceived with the message that player2 gave.
if you ask "is it okay to "steal" other plugin's code", then generally, yes, if it's only a tiny amount of lines
even if they prohibit it, it's totally legal if it's "nothing special"
i stole 11 lines in total from jefflib
If its just data in SQL, then thats fine
Basically i have an economy plugin and all their data is saved in a sql. Example how much money they have
JeffLib is GPL3, everyone can "steal" from it
?
I want to create a custom made plugin and take their existing data and import it into my own plugin. So they wont lose their progress
If it makes sense
But I only get version 1.8.8 normally @tender shard
It only returns the message saying "The RSP is null"
No need to bump your question after one minute
ok
erm yeah, that's the only version you'll ever get
there is no 1.8.8R3
i am not sure what i'm being asked about
THX
1.8 people ¯_(ツ)_/¯
?paste your code
I also gotta remind everyone of this! ^^^
Or we can;t be bothered to answer 😉
yes but they'll throw a tantrum if you tell them this 😄
you literally check if the clicked inventory is a PlayerInventory
I am using this method to update lines in scoreboard and its updating, but its adding one line and its not deleting old one like on pictiure. Does anyone now why is this happend?
UpdatePerLine():
public void updatePerLine(Player player, String line, int scoreSlot) { if (!Bukkit.getOnlinePlayers().contains(player) || (player.getScoreboard() == null)) { return; } for (String str : player.getScoreboard().getEntries()) { if (str.contains(line) || str.equals(line)) { player.getScoreboard().resetScores(str); } } org.bukkit.scoreboard.Scoreboard score = player.getScoreboard(); score.getObjective(DisplaySlot.SIDEBAR).getScore(line).setScore(scoreSlot); }
just get rid of that check
😄
just remove the getType().equals(...) thing
btw you normally use == to compare enums anyway 🙂
.equals() on enums doesnt make any sense
but it also doesnt hurt
alr
it still only works for the inventory..
show your current code again pls
the BuildTools bring with nothing only get the 1.8.8-R0.1
@tender shard du you know if you can force that elder guardian that pops up and jumpscares you everytime you come near an ocean tempel?
explain what you mean by "bring with nothing only get the 1.8.8-R0.1"
no, sorry, I have no idea how they work. Never looked into it
ok
reminder that 1.8.8-R0.3 doesn't exist
looks good to me, except that you still use equals() everywhere
I need version 1.8.8R3
there is no such version
e
there is a bukkit version "1.8.8-R0.1-SNAPSHOT" and an NMS version "1_8_R3" and both are provided by doin g BuildTools.jar --rev 1.8.8
it's probably client sided then
yeah pretty sure it's the same thing but named differently
yeah could be
ok
so i fixed the .equals() thing, but it still doesnt work....
is there any way to jumpscare a player then
totem anim?
i have this so far
how
yeah as said, this is not the problem. Please add debug statements after every if(...) thing and then you'll see where it returns
come on it took me 4 seconds to google https://www.spigotmc.org/threads/totem-animation.306164/
Put a pumpkin on their head for a second and play a sound?
kk
sowwy
the totem animation is part of JeffLib btw
^
Totem animation ^
e.g. for 1.19.2: https://github.com/JEFF-Media-GbR/JeffLib/blob/master/spigot_1_19_2_R1/src/main/java/com/jeff_media/jefflib/internal/nms/v1_19_2_R1/NMSHandler.java#L175
you could summon grass Infront their face... i dont think they have seen such a thing in a while
lol
but... p.playEffect(EntityEffect.TOTEM_RESURRECT);
wellll...
i actually never saw a totem animation from another player's view
well that scared me xd
What is even totem animation
Does anyone know any plugins, to disable fly when leaving the worldguard region?
worldguard wont disable fly
?paste
it wont allow you to do /fly
I'm pretty sure you can also disable flying
Check region flags
i asked in the discord chat
i need to find another plugin to do that
alright, i think ima go for a different approach.. so ive added this disable right/left click thing because if you would get a dragon egg in your inventory, you would gain +100 levels and if you would drop it, you would loose those 100 levels, but there was a bug where you would right click the egg when its in your inventory very fast and it would cause level duplication... so i need to fix that and found no good solution.
@tender shard getting a really weird error about deserialization, but i'm not even deserializing anything? https://paste.md-5.net/agujegaxiz.rb
but you usually do
Sorry I dont have time right now, brb, gotta get someone banned from another discord quickly, then I'll get back here
You added an object to yoru config io.github.zbllcuber.prison.runes.RuneStatistic
?
soryr wrong ping
lol
^
hoe to get the NMS Version: 1_8_R3
private static final String NMS_VERSION = Bukkit.getServer().getClass().getPackage().getName().substring(23);
we already explained it to you three times
you run buildtools --rev 1.8.8
unless he wants teh actual string ^
also a quick side-question: how do check if a dropped item is a dragonegg?
is the source of the drop a player or any
basically, i need to detect if there is a dragon eff item dropped in the world...
public void sus() {
World world = null;
for (Entity entity : world.getEntities()) {
if (entity.getType() == EntityType.DROPPED_ITEM) {
System.out.println("THERE IS AN ITEM OMG!!!!!!!!");
}
}
}
idrk if i did it right tho
org.bukkit.event.player.PlayerDropItemEvent
NMS Version
could be also a dropper or sth like thta
-_-
how do i initialize the world tho?
i want all dimensions basically
kk
gets all worlds?
kk
Pretty sure teh dragon egg is a block not an entity
ah ok
no, i mean if its dropped
it is an entity that behaves as a block

what
same with the chest
1.8.8-R0.1 = 1_8_R3 please stop
o you were referring to the dropped item
do droppers behave as blocks?
it doesnt work tho since i compare world with entity....
the dragon egg block also is not a tile entity/block entity
Yeah, not a TileEntity https://hub.spigotmc.org/javadocs/spigot/org/bukkit/block/TileState.html
and then
public void getAllDroppedItemsOnGround(World wrld) {
wrld.getEntities().stream().filter(entity -> entity instanceof Item).forEach(entity -> {
Item item = (Item) entity;
if (item.getItemStack().getType() == Material.DRAGON_EGG) {
//do something
}
});
}```
thats how i'd do it
Well, yeah, RuneStatistic exists in my cnofig, but how is that related? I am not trying to deserialize it or even use it
that error says you are
?paste your config
would this work?
public class EggTrackerFunction {
ItemStack egg = new ItemStack(Material.DRAGON_EGG);
public Location playerHoldingEgg;
public Location itemDropped;
public Location itemStored;
public void getAllDroppedItemsOnGround(World wrld) {
wrld.getEntities().stream().filter(entity -> entity instanceof Item).forEach(entity -> {
Item item = (Item) entity;
if (item.getItemStack().getType() == Material.DRAGON_EGG) {
System.out.println("YOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO AFTER 128912849819248 HOURS!!!!!!!");
}
});
}
@EventHandler
public void ifplayerdroppssoapO_O(PlayerDropItemEvent event) {
Bukkit.getWorlds().forEach(this::getAllDroppedItemsOnGround);
}
}
lol
Why check every world and every item to see if its a dragon egg?
You are checking in teh drop item event, so why not just check that item?
What exactly are you trying to do with this dragon egg?
i wanted to make a dragon egg tracking device (compass) that points to the dragon egg even if its a block/item/player who has it
oh my, that is going ot be hard
its kina hard but its a challenge i want to do lol
Yea that is not easy
yep...
it could be in a chest in a chunk thats not loaded
thats the reason i joined the spigot dc
oof
You are not going to be able to check every chest
It'd be nearly impossible to keep tracking on it tbh in its current state as you don't know where it is
maybe save the loc of the chest when a player puts it in?
Valid idea tbh you could prob track its movements from there
if you track it from its first creation it should be possible
but there are LOTS of things you will have to monitor
yes exactly
Droppers, Hoppers, Players moving items, pistons
true
Tbh there is no better way to keep track other than monitor all of those events
i think ill need to work with events
Searchign every world for items is not the way to go though
Pff ofc bukkit is event based
tbh thats true
eg, Egg spawns, player breaks with a piston, picks it up, puts in chest. hopper pulls it from a chest into a dispenser, into another chest. you have to monitor all events
Player dies and another plugin like angelchest puts it in a chest.
trackign is going to be near impossible
the thing im kina stuck at is what if a player does offline with the egg?
You're kinda screwed at that point.
There is no guarantee that the player will log on again. So, if they take it and leave. The egg will be forever lost.
PlayerDropEvent
Check the slots
cancel playerdropitemevent
if he drops it from his hotbar
How can i check if it is on his hotbar?
THE DRAGON EGG TRACKER CHALLENGE
alright, if u want to help me do this almost impossible task then text in the thread i made
Could someone help me to get the 1.8.8 r03
i think ye
ah Player#setCompassTarget ig
declaration: package: org.bukkit.entity, interface: Player
@quaint mantle Did this answer your question? Or did I understand it wrong?
You have been told a few times how to get 1.8.8 and what the R3 means
does evey minecraft item have ItemMeta?
not air and some other stuff
meh should optimize my parser, 2+((1+1)) parses 1+1 twice :/
"a few times" like 5 at least
ah i see, yea looks good
Does anyone know in what case PlayerMoveEvent#getTo() returns null?
cuz it's marked as @smoky tinsel
maybe when the player first joins?
and if not, every second?
why would it be called
if he isnt moving
if no movement is done
the event is called playermoveevent
not playertickeverysecondevent
to tell the server hes still there idk xD
uhm
thats just a per tick runnable with extra steps then
if it's a playerMOVEevent, it's called when a player MOVES
including their camera
does reloading server decreases the performance and causes crashes do you think?
yes
It also sends it for mouse movement
many plugins don't handle reloading and will break
a picture
I am making a minigame-server with bungeecord:
How is restarting the sub-servers on the end of the game and resetting their map usually handeled?
or docker
so the game-server tells bungeecord when the game finished?
like how does it do that
idk how to implement it
gonna learn docker in school next week lol
u learn that in school? o.O
I learned it in university xD
college
Ok ty, i'll look into it
last day holiday today smh
How can I check if config contains key? In bungeecord.
So to restart the server, i gotta make a plugin for bungeecord which just does the map stuff and calls the bat file?
contains
is that right? cuz ive seen that there's a plugin folder in my proxy folder
never made a bungeecord plugin before but would be good to know if thats the way
okok
so thats how people usually do it right? (if not using docker) :
send a message to bungeecord, which then calls a function in a bungeecord plugin, which you make yourself
which then resets the world and calls the sub servers bat file
NBTEditor import?
Hello ppl.
Any way to change blocks piston move reaction?
Would be nice if it could be changed based on location.
nvm
what do u mean?
change reaction?
u can cancel the event in general
How do I get the command the player used in a PlayerCommandSendEvent?
and cancel depending on biome and etc
oh my
what is that event
use AsyncChatEvent instead
and check if player used / before
hm ok
Ok so I can block blocks moving.
What if I wanted to change the behavior of say obsidian to be moveable ?
obsidian not being pushable is hardcoded into the server
you can probably do some fancy injection to get around that
public static boolean isPushable(BlockState state, Level world, BlockPos pos, Direction direction, boolean canBreak, Direction pistonDir) {
if (pos.getY() >= world.getMinBuildHeight() && pos.getY() <= world.getMaxBuildHeight() - 1 && world.getWorldBorder().isWithinBounds(pos)) {
if (state.isAir()) {
return true;
} else if (!state.is(Blocks.OBSIDIAN) && !state.is(Blocks.CRYING_OBSIDIAN) && !state.is(Blocks.RESPAWN_ANCHOR) && !state.is(Blocks.REINFORCED_DEEPSLATE)) {
gonna be rough
just inject into all the code that calls it
So I take it that there is no API way of changing the response.
what class is that at
java/net/minecraft/world/level/block/piston/PistonBaseBlock.java
That can't be it. Can it ?
I thought they have a better way of deciding what blocks are moveable.

welcome to mojang code lol
they have a different system in place yea
okay... this won't be so hard
But BlockBehaviour has getPistonPushReaction
Why not use that
wtf
¯_(ツ)_/¯
some blocks can override it
Yeah this doesn't seem that hard
sure the registry is frozen but you can just unfreeze it with reflections, modify it and refreeze
maybe like 150 lines
Oh yeah I do not want to do that.
I can but don't want to.
I'll just... not do this.
how would unfreezing the registry help here
PistonStructureResolver also calls that canPush method but it is initialized on the PistonBaseBlock class exclusively so you can just make a wrapper and not worry much
Since it's all static, you'll need to override some methods
yea
So you make your custom class that extends PistonBaseBlock

override the methods to handle your changes
I want to run code in onEnable() that could take a while to run (copying a big map, to use as server map - effectively resetting the map)
Can players only join after this code finished / onEnable returned? Or do i have to somehow block player joining?
and then change the registry to use your custom piston object instead of the nms one
Yeah this doesn't seem that hard
you have a wild scale of what is hard to implement lol
I implemented mob collisions with client-sided blocks
seems rather doable
All the collision code was scattered around multiple classes and did fancy bitmasking
It isn't. I once registered custom blocks with Spigot for some reason.
This time however I do not want to touch NMS.
I also had to inject into navigation so mobs couldn't track players through client-sided blocks
I think it was about 1.2k lines of nms in total
sounds enjoyable tho like
I would still not call it "not too hard"
maybe you are just good 
show us your worlf impl
I mean yea your issue is just clazz.getDeclaredConstructor().newInstance(true);
oh yeah
you pass the params on the getDeclaredConstructor
so
class.getDeclaredConstructor(boolean.class).newInstance(true);
you can't really enforce parameter specifics for newInstance because you never know how many there are
your IDE could've warned you
I am trying to make it so that when you merge two of these crystals it deletes the original two and gives you a new one of the new merged value but when I delete them from the players inventory it places the cursor item back in the players inventory. I am not sure how to fix this. Any ideas?
Code:
@EventHandler
public void InventoryClick(InventoryClickEvent e)
{
Player player = plugin.getServer().getPlayer(e.getWhoClicked().getUniqueId());
if (player == null)
{
plugin.logger.Error("InventoryClick - Player is null!");
return;
}
ItemStack heldItem = e.getCursor();
ItemStack clickedItem = e.getCurrentItem();
// Check if both Held Item & Clicked Item are both valid
if (heldItem != null && clickedItem != null)
{
ItemMeta heldMeta = heldItem.getItemMeta();
ItemMeta clickedMeta = clickedItem.getItemMeta();
if (heldMeta != null && clickedMeta != null)
{
// Check if both are nether stars
if (heldItem.getType().equals(Material.NETHER_STAR) && clickedItem.getType().equals(Material.NETHER_STAR))
{
NamespacedKey rarityKey = new NamespacedKey(plugin, "Rarity");
PersistentDataContainer heldPDC = heldMeta.getPersistentDataContainer();
PersistentDataContainer clickedPDC = clickedMeta.getPersistentDataContainer();
// Check if both stars have the NBT Tag Rarity (the rarity NBT Tag is how we determine a nether star is an actual crystal)
if (heldPDC.has(rarityKey, PersistentDataType.STRING) && clickedPDC.has(rarityKey, PersistentDataType.STRING))
{
CrystalRarity heldRarity = CrystalRarity.valueOf(heldPDC.get(rarityKey, PersistentDataType.STRING));
CrystalRarity clickedRarity = CrystalRarity.valueOf(clickedPDC.get(rarityKey, PersistentDataType.STRING));
// Check to see if both crystals match rarities
if (heldRarity.equals(clickedRarity))
{
NamespacedKey chanceKey = new NamespacedKey(plugin, "Chance");
Integer heldChance = heldPDC.get(chanceKey, PersistentDataType.INTEGER);
Integer clickedChance = clickedPDC.get(chanceKey, PersistentDataType.INTEGER);
// Confirm both Crystals Chances aren't broken
if (heldChance != null && clickedChance != null)
{
plugin.enchantManager.MergeCrystalValues(player, heldRarity, heldChance, clickedChance);
//player.getInventory().remove(heldItem);
//player.getInventory().remove(clickedItem);
heldItem.setType(Material.AIR);
clickedItem.setType(Material.AIR);
}
}
}
}
}
}
}
NVM! After some more testing and forum searching I discovered that this fixes the issue entirely <3
e.setCancelled(true);
e.setCurrentItem(new ItemStack(Material.AIR));
e.getWhoClicked().setItemOnCursor(new ItemStack(Material.AIR));
Hello I have a problem the event that I do with onJoin dont work
public void onJoin(PlayerJoinEvent e){
e.setJoinMessage("Test");
}````
The event dont work
summon an entity as a passenger
of other entity
would require me to first summon the entity
and then set it as pessenger
registered it?
did u register it?
What did you mean with registered it?
and maybe try system.Println.out("joinevent")
to see if it even works
learn java first
please.
?1.8
Too old! (Click the link to get the exact time)
https://gyazo.com/7aecab4c98d4fef4d1c3d3ff5b42dd8b
Why is it not syncing with my body if i turn? xD
?java
lmao thats awesome
Bukkit.getPluginManager().registerEvents(plugin, new JoinListener())
what version you made this shit in?
im curious
1.12.2 its a harry potter broom hahaha
modify the armorstand rotation
to be sharper
in some cases
but still soms issues with turning
or force it turn slow.
Aah thanks i will try that
less player control
player should be able to control it but not fully
like it will rotate slowly
Where I need to put that code ?
onEnable
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
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/
Ok thx
This bracket style makes me puke
theres this thing called methods
early returns lol
i believe i have found a spigot bug if anyone can confirm, this does not occur on forks of spigot such as purpur or paper
Inventory#ContainsAtLeast() does not work seemingly at all for items with specific metas
with the following test code
boolean has = inventory.containsAtLeast(i, i.getAmount());
if (!has){
for (ItemStack item : inventory.getContents()){
if (Utils.isItemEmptyOrNull(item)) continue;
if (i.getType() != item.getType()) continue;
if (!Utils.getItemName(item).equals(Utils.getItemName(i))) continue;
System.out.println("ingredient \n" + i + "\ninventory item:\n" + item);
}
}
so containsAtLeast returns false even though the required item and the item in the inventory are exactly the same
i also dont think this occurs on older versions of spigot, this issue wasn't there in 1.18
because these item metas need to match
checking on material alone will return true even if the item isn't the same as the one required
check ItemStack#isSimilar then ig
i want to summon an entity that will have pessenger
i can summon them both together
or its not really possible
i should summon and set it to pessenger afterwards
summon two entities and set one of them as the vehicle for the other
i mean i'd have to basically write my own containsAtLeast method to accomplish this, point is is this a bug or not?
or is there something about this method im missing
its not supposed to check for meta ig
hiii fourteen ❤️
and probably on older versions though i havent double checked this
hello
i also forgot to mention that Inventory#removeItem() similarly doesn't work
?stash
bro why does currentTimeMillis return date correctly but not the time 😢
I want to teleport player to where they'd if they entered a nether portal at their location
how?
wdym
I want to simulate player entering portal without there being a portal
nether
I want to call my constructor like this:
new CountDown(10, () -> { ... }, () -> { ... }).start(); (first function has to return bool, second void. both take no arguments)
How can i do this? How can i make it take two anonymous functions of a specific return type?
by taking a Function<?>
ah that simple? nice
Maybe with the Travel Agent
You should create a system of item tracking
That updates maybe with a timerTask or just when a player calls some events
@tender shard hey bigbrain man pls enlighten me on how you'd go around generating current date on YY:MM:DD HH:MM:SS
yes but like what would you go around using
calendar?
SimpleDateFormat?
Date now = new Date(); SimpleDateFormat format = new SimpleDateFormat("your format");
google "SimpleTimeFormatter"
and stop calling me "bigbrain man"
ok smallbrain man it is then
smallbrain man ?
lol
you can just call me "mfnalex"
t
t
t
t
t
oh god what have I started
t
there i am asking for help with serialization once again
am i doing it right? i cannot test it rn so just thought i'd give it for a look
@NotNull
@Override
public Map<String, Object> serialize() {
Map<String, Object> map = new HashMap<>();
for (RuneStatistic statistic : statistics) {
map.put("statistics." + statistic.getId(), statistic);
}
map.put("rune", "rune");
map.put("runeTier", runeTier);
map.put("headItem", headItem);
map.put("id", id);
return map;
}
public static Rune deserialize(Map<String, Object> map) {
ConfigurationSection statisticsSection = (ConfigurationSection) map.get("statistics");
List<RuneStatistic> statistics = new ArrayList<>();
for (String key : statisticsSection.getKeys(false)) {
statistics.add(RuneStatistic.deserialize(statisticsSection.getConfigurationSection(key).getValues(false)));
}
ConfigurationSection section = (ConfigurationSection) map.get("headItem");
Map<String, Object> deserializable = asMap(section);
ItemStack headItem = ItemStack.deserialize(deserializable);
return Rune.builder()
.statistics(statistics)
.runeTier((int) map.get("runeTier"))
.headItem(headItem)
.id((long) map.get("id"))
.build();
}
can you apply .sethoverevent to only a part of some text?
use componentbuilder
hi bigbrain man how ya doin
How to set Void as return type?
why the heck can void not be converted to Void, but int to Integer aint a problem?
why would a function be void though
what do i do instead of Function<Void, Void>
cuz it doesnt return anything?
what else would it be if it doesnt return anything?
you should use consumer
wait if they’re both void then wouldn’t it just be a runnable
ah so i can just use runnable?
and if it takes an input but returns void its consumer
and else its function?
three different classes for basically the same thing?
well if you don’t need to supply an argument and it also returns nothing, it’s a runnable
If you’re supplying a value but no return, consumer
if you need to supply a value and also get return, function
and if it’s only returning it’s a supplier
couldve just made Function<> usable for all three cases and boom, other two arent needed
i see
How do yous set your IntelliJ IDEA run configuration for testing plugins? I was hoping I'd be able to use Maven properties like this so that the configuration would work for all my plugins without having to configure the filename/location but it doesn't seem to
four classes for the same thing
xD
damn xD
but good to know, thank you!
now i can implement it right :D
Nicu!
Not sure if this is the correct place to ask but I have a bit of a weird request. I'm in need of a plugin or datapack that unpatches the baby piglin dupe from 1.16.1 for a 1.19.2 paper server. I'm honestly hoping to find someone who can do it for free since it's only for a temporary server with some friends from anarchy, but I know that paper can be a pain so it's up for discussion. Is there anyone here that can help me out?
you can add something in maven pom for that
I can? And what would that something be?
you use a Consumer instead of a Function
<configuration>
<createDependencyReducedPom>false</createDependencyReducedPom>
<outputFile>YourFolder/plugin.jar</outputFile>
</configuration>
Oh, I didn't know that! Though, I feel like the pom should be effective for everyone that uses it, especially since I make all my plugins open-source, so having a hard-coded output location seems bad in that sense
true. you can use profiles for this
google "maven profiles"
Like, I don't want to be including the path to my testing server in all commits I make to GitHub 😅
I'll have a look, thank you!
np!
profiles are basically "additional configs" that only run when you do -p myProfile
i had a bad experience with github :l
Runnable
i trusted it one and uploaded my file for back up
yeah, if both are void, you use a Runnable. If only 1 thing is void, you use a Consumer
and it some how delete most of classes
it be like
Runnable: No input, no output
Consumer: 1 input, no output
Function: 1... input, 1 output
(one, two, three) -> return four
translates to
public <Type of <four> (can be void)> doesntMatter(one, two, three) {
...
}
There's also a Supplier for no input, 1 output
sure
Supplier: No input, 1 output
BiFunction: 2 inputs, 1 output
BiConsumer: 2 inputs, no output
Predicate: 1 input, returns boolean
BiPredicate: 2 inputs, return boolean
And a few mor
lmao
plez
bump
in general, this looks okay to me
but why do you seralize the "rune" thing?
if you always set it to "rune", you might as well not save it
if (seconds > 2) player.sendMessage(ChatColor.GOLD + "Starting in " + startCountdown + " ...");
else if (seconds == 2) player.sendMessage(ChatColor.YELLOW + "Starting in " + startCountdown + " ...");
else if (seconds == 1) player.sendMessage(ChatColor.RED + "Starting in " + startCountdown + " ...");
is there a more compact way to do this?
besides
player.sendMessage((seconds > 2 ? ChatColor.GOLD : seconds == 2 ? ChatColor.YELLOW : ChatColor.RED) + "Starting in " + startCountdown + " ...");
cuz a triple ternary is kinda ugly and unreadable?
In JS one could just do it like
player.sendMessage([ChatColor.RED, ChatColor.YELLOW, ChatColor.GOLD][Math.min(seconds-1, 2)] + "Starting in " + startCountdown + " ...");
I'd do it like this:
ChatColor color = ChatColor.GREEN;
if(secondsRemaining == 1) color = ChatColor.YELLOW;
// ...
player.sendMessage(color + "remaining text");
compact != better
then create a new method called "getChatColor(int)" or sth like that
often times its worse
I would rather have clean simple to understand anytime over something that you have to think about how it works. Especially in debugging
Spigot truly can be the worse when it comes to loading stuff from configs can't it?
not really, why?
Nah
navigablemap
in fact spigot put a good amount of work in wrapping SnakeYaml into a fool proof system
It's really struggling to load a map from the a config lol
In general, serializing stuff can be hard some times
I can't work out how to load the following data correctly 🥲
materials:
STONE: 0.9
COBBLESTONE: 0.1
getConfig().getDouble("materials.STONE")
etc
I can't do it that way though.