#help-development
1 messages · Page 2011 of 1
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
if(args.length >= 1 && sender.hasPermission("crates.admin")) {
switch (args[0]) {
case "reload":
CratesPlugin.getInstance().reload();
sender.sendMessage("§aCratesPlugin config reloaded.");
break;
}
return true;
}
if(!(sender instanceof Player)) {
sender.sendMessage("You must be a player to use this command.");
return true;
}
try {
User user = UserProvider.get(((Player) sender));
user.showMenu(MenuManager.getMenu(user, Menu.Type.CRATES, -1));
user.setViewingCrates(true);
user.success("Opening the crate menu.");
} catch (Exception e) {
e.printStackTrace();
}
return true;
}
what is line 47
I guess you can use an aoe cloud
They both tick though so I doubt it’s much different
the file has 42 lines
i think the stand tick is heavier because it's a livingentity
it says line 47 here or am i stupid
hm right
then no big deal
check what is the ex caused by
spigot throws the command exception when it catches one so the actual ex should be under caused by
iirc its showMenu, but this is the entire code in showMenu, and menu.getInventory is a final value initialized with Bukkit#createInventory
and player.getPlayer() can't be null as i first check player.isOnline
oh wat
yeah thats the full exception
yeah
how do I teleport a player to somewhere
found it
How would I go about applying completely custom NBT data to a itemstack?
?pdc
can I use == for worlds or do i need equals? iirc they are the same instances
lemme check the implementation
No, not custom persistent data
I am talking raw NBT data
A json formatted string
nbt more like
Idk why you need to do that
id excpect equals(...) to do the same thing as == cuz i dont think it will check all blocks
But NMS
Figures
Probably just compares uuid
Or name
yeah thats also possible
Why do you need to set a json string on an item
Because it's for a config system where a user is able to append a custom tag to a item
For whatever reason they need it for
it is dangerous to think that this is the case
I mean that sounds like pdc would work fine
It does not
Bukkit creates wrapper objects, so they may differentiate (instance-wise) without differences in runtime behaviour
i've just checked the implementation and yes calling equals compares uuids, and also it's used in spigot's code so i guess equals is needed just to stay safe
Not like comparing UUIDs will be slow anyway
it was not really for performance, just curiosity
Why isn’t PDC working for you for your use case?
I’m struggling to think of a scenario in which it fails
if you don't want to use pdc, you can either mess around with nms or use nbtapi and don't go through the pain
Forgot about nbtapi
Because many of the keys are not custom values, but vanilla ones instead
Namespacedkey has a constructor that allows to input a string as the key, even tho it's meant for internal usage only so maybe that could suit your case better
I knew someone who uses nbt because they don't like how there's no documentation on TAG_CONTAINERs
That still doesn’t let you access vanilla tags
I don't want alternative approaches, I want to know how to modify the nbt data attached to a object
NamespacedKey.vanilla(string)
Doesn’t work
no?
hm right because the key would have to be something anyways
Because it still gets put in the PublicBukkitValues container
.
So how can I construct a compound tag from a json object with unknown layout
nms
Gonna have to dive into NMS to find that out
Maybe you can find something online, who knows
so the reason you don't use pdc is because the user specifies the keys, right?
It’s because they want vanilla keys to work too
what's to stop them from throwing a map in a pdc
get the pdc and then get the keys from the map
...the fact that I want vanilla keys to work?
You know what, just forget it, I'll figure it out
So what do you use for checking classes or objects ".equals()"?
lol
since when are chunks not properly aligned at -1, -1
?
it's 1 wide
the middle is -1 -1
that's very annoying
i wanted to chunk align islands
hey everyone i have a question
how can i override another plugins existing command ?
command preprocess event
y e s server outdated
if you want to completely replace it you need to mess with the knowncommands map but you should be fine with that
Nah the event works
same if you want to remove it
and no this isnt me asking for help ofc
You could remove it with the event too
Is there a somewhat easy way to detach a player from their body with packets so to speak? Like, have their game character in one place and have the player's view in spectator?
I want to make sort of a freecam plugin
Where their body stays where they are so they can't use it to just escape mobs
i guess you could stop incoming movement packets but the player would not see themselves at the original location
also im not sure how could you resync the player with the server
I am trying to make a wolf despawn after a certain amount of time after being summoned as a guard, it doesn't give me the length of time lived nor does it work with another method of getting the world. I have tried making this check occur in the function that spawns it and getting the world through that but that still doesn't work. If you can explain what is wrong I would appreciate it!
public void main(String[] args) {
for (Entity e : Objects.requireNonNull(this.getServer().getWorld("minecraft:overworld")).getLivingEntities()) {
if (e instanceof Wolf) {
if (Objects.equals(e.getCustomName(), ChatColor.GOLD + "Queen's Guard")) {
System.out.println(e.getTicksLived());
for (int i = 0; i <= 100; i = i + 10) {
System.out.println(e.getTicksLived());
if (e.getTicksLived() == 100) {
e.setSilent(true);
e.remove();
}
}
}
}
}
}
Perhaps it'd be just easier to spawn in new player on the server while they're in ghost mode
it would be better to just save the location where the player started to freecam and then teleport them back
make a fake player with packets and just don't let the og player see the fake player 
wanted to have it so if they get hit by a mob or a player, it yoinks them back
Well yeah, but I don't want it to be advantageous
because you can just use it to escape a sticky situation
put them in spectator
Am I doing this correctly?
stand.setCustomName(ChatColor.getLastColors(EmeraldsPlugin.jp.getConfig().getString("Crates."+blockKey+".Color")) + EmeraldsPlugin.jp.getConfig().getString("Crates."+blockKey+".Name"));
Its not setting the color
Color: GREEN
in config.yml
say you're down to one heart and surrounded by mobs, they could just poof off and wait for them to leave
Yeah getLastColors won’t work there
hm thats right too
you want the wolf to live for 5 seconds?
You would have to use ChatColor.valueOf
then you should do this
do you know if this player can be targeted by mobs?
I was making it only last for 5 seconds to test it
but again i am not sure how could you resync the player
idk
Fake players don’t exist server side
I don't use packets
So no
I'm not looking to spawn in a fake player altogether
I just want to create a semi real player
that will be seen by the server as a real player
@young knoll Can you get the state of an armor stand?
Cause Idk how lol
for getPersistentDataContainer
dont tag, as i mentioned many times. You should be patient, as everyone here
do this i guess giz
Iirc it’s just getPersistsntDataContainer on entities
blocking like that on the main thread is not the greatest idea, you could use a task later to kill the wolf
Nice ?jd moments. Hahaha. I dont know why people doesnt like reading it 😡
?scheduling ^
I dont know why javadocs where invented if most people doesnt reading them...
quality issues
skill issue
doesnt seem like you can on the ArmorStand class
Why skill issues or quality?
no
entity extends persistentdataholder
Idk i think i cannot use an api without having the documentations
some of teh docs are not all that clear and some reading abilities do not include comprehension
but ofc you can't call it on the class, but on an instance of the class
if you are doing something like ArmorStand.getpersistent... consider learning java
no lol
can i vonvert ArmorStand to Entity?
yes
^
it is an Entity so you can cast it
yeah
there is no need
but you dont need to
?
a child class identifies as its superclass too
it has all methods the entity has
oh no need to call it as an Entity
or its interfaces
.
inheritance
there is certain times you might want to cast
When?
oh my god im an idiot
i didnt realize
stand.getPerst... exists
;-;
lets say you were dealing with other types of entities, and need to be able to compare for example
That why i always told you, and im like a parrot telling you - "Javadocs (jd) is your best friend and you always ignore the message". But idk its like not my problem, im just giving you the tools to work faster
Oh ok thanks.
alright
And sorry if i look rude but sometimes i run out of patiente
No its understandable
i don't really understand how you didn't notice that getpersistentwhatever autocompleted when you wrote it after stand.
buttt its fine i guess
not everyon uses autocomplete
can making particle lag servers?
they are sprites played client side so afaik, no
In all seriousness however, is there a way I can store an object in a PersistantDataType?
it doesnt seem I can and I want a way to delete a armorStand later on
Why tag, btw. just anways the message and its tag too
mhm yea ok it does
[ERROR] .... --- DO NOT REPORT THIS TO PAPER - THIS IS NOT A BUG OR A CRASH - git-Paper-399 (MC: 1.17.1) ---
most that can happen is that the server gets overloaded because it has to send too many particle packets but i really doubt it
Yeah i know but you can answer the message
And it tag me too
But no problem
hahaha
stand.getPersistentDataContainer().set(new NamespacedKey(pluginInstance, "testTag"), PersistentDataType.STRING, "hello")
from memory, might be wrong but thats the general idea
i did while(thing){particle} instead of if(thing){particle} https://cdn.discordapp.com/emojis/809219738109476865.webp?size=64
What kind of object
Location
more than serializing it, break it down into doubles and a string
I usually just store locations as world;x:y;z
wha?
oh
ever heard about my Tower of Babel staircase?
used this do draw shapes with particle
yes, i dont remember how but yeah
Bukkit#dispatchCommand(sender/player, "command")
this ^
not that bad is it?
it just defeats basic oop principles and its unreadable
but apart from that nothing that bad
lmao
Potion effect
^
it's not complete darkness
You cant
nope
Its not supported front the client
you can and i am thinking
?paste
you can, send them to void
No
https://paste.md-5.net/abugotiwod.bash I'm getting this.
^
ok i give up
If you're so sure, why are you asking us?
lots of black particle
You cannot set the client completly black, because the client doesnt support it
?jd may say it
mmm
i am sorry you have to go through this
wtf of a reply is that
it's about spigot development+
using packets is a big part of it
I'm just saying this is the spigot server, you should at least expect the people here to be knowledgeable about the api itself
bro
is it though?
it's not in spigot, but you can send them with plugins
it's the minecraft server protocol which is not part of spigot
sys what if you showed a fake block on the player's head? when your head is in a block the screen should be pitch black
For all those people who find it more convenient to bother you with their question rather than to Google it for themselves.
So if you know how to do it. Do it by your self.... Just asking for support and them you shitying us that we are trying to help...
Technically speaking they are not. Packets are part of nms. Spigot abstracts everything packet related away.
But packets have traditionally been a big part of Spigot development.
unless you need the effect to move with the player
sysdm ^^^
... Did I type this correctly..?
Bukkit.dispatchCommand(p, "/execute @a "+block.getX()+" "+block.getY()+" "+block.getZ()+" @e[type=armor_stand,distance=2]");
Feel like I screwed up somehow
im trying to check if a item has itemmeta the thing says it doesnt have any item meta but I generated it with itemmeta. how to fix?
I did lol
Yeah, I'm being a little pedantic. My point is don't expect world class help with packets here. You can ask of course, but don't get pissy when no one can help you
then if worked its right
Show some code pls
is delay 0L longer than 1L?
https://paste.md-5.net/abugotiwod.bash can somebody take a look
yes sorry
After editing metada, you have to set it back to the item - Check that
The only ItemStack that does have no ItemMeta is air
public static void giveItem(Player p, Items item, int amount) {
String name = item.getName();
String lore = item.getLore();
ItemStack itemStack = item.getItem();
itemStack.setAmount(amount);
ItemMeta meta = itemStack.getItemMeta();
meta.setDisplayName(name);
List<String> loree = new ArrayList<>();
loree.add(lore);
meta.setLore(loree);
itemStack.setItemMeta(meta);
p.getInventory().addItem(itemStack);
}``` setting
```java
if (e instanceof EntityDamageByEntityEvent) {
if (p.getInventory().getItemInMainHand().hasItemMeta()) {
for (Items item : Items.values()) {
if (item.getName().equals(p.getInventory().getItemInMainHand().getItemMeta().getDisplayName())) {
for(Item i : ItemManager.items) {
if (i.enumeration.equals(item)) {
i.execute(p, p.getInventory().getItemInMainHand(), (EntityDamageByEntityEvent) e);
Bukkit.getLogger().info("Executed " + i.enumeration.getName());
return;
} else {
Bukkit.getLogger().info("4 " + i.enumeration.getName());
}
}
} else {
Bukkit.getLogger().info("3 " + item.getName());
}
}
} else {
Bukkit.getLogger().info("2");
}
} else {
Bukkit.getLogger().info("1");
}``` checking
i have never seen such behaviours in this chat lol
you asked how to make a player's screen black, people answered, and then you clarified after that you wanted it done with packets
it only gets to 2 tho
?paste
No they are both the same
Paste the code there
oops sorry
No problems :happy:
k thanks
also another flaw, if the player is not centered it might not work really well
you could probably just send a 3x3 cube of black concrete to their location
maybe the suffocation pitch black can even be simulated by sending a packet
not sure
i am not sure tho
The most reliable/less disrupting way to make the screen of a player black is by using a forced resourcepack.
You can substitute a character with a huge black square and display it as a title to the player.
smart
Night vision and blindness used to make a super black effect as well
Hey, this is a great idea but are you sure the character can get that large?
Not sure if that works in the current version
wonders why you dont just alter the demoscreen and push a resourcepack to make it black
or replace pumpkin vision
https://paste.md-5.net/abugotiwod.bash can u help
Agree
In what cases are you making a player's screen black? Is it when they're in a specific state or place, or will it occur at any time?
Specific state
Only with a bit of tinkering
You might as well just have a block of black concrete and put the player there lol
if it's one location
ah
another thing, what if you showed a falling sand at the player?
And why you wanna set player screen to black?
https://www.youtube.com/watch?v=teCsBdCBqjA
I've recreated the following, all the math, etc. It's really smooth, but my only issue is the black screen. I apologize for my friends actions from before. I'm essentially trying to achieve that.
you could throw a 3x3 cube of black concrete on the player with sendBlockStateChange
does it make the vision black too?
i dont' remember tbh
you could make it move with the player
@weary geyser
its easy
put them in a black concrete cube
night vision level 255
blindness level 255
I'm much more experienced with Java itself than the Spigot API so I need a little bit of direction.
You have quite a bit of refactoring to do...
Anyways: Check custom items by using PDCs and not names or ItemMetas.
when they send a movement packet, relocate the fallingsand
or put them in void in a level they dont die, and make them unable to fall
Well it's supposed to fade.
Won't work in this situation.
just ignore them
It's intended to fade?
Yes, look at the video I sent above.
Oh
Might be a bit of a challenge to get that effect
Though a resource pack is your best option I think
I like @lost matrix 's suggestion of the title but I'm not sure if the character can get that large.
I have a proposal, actually
I'm all ears haha
pdc's?
Woudlnt use NBT for that types of operations?
?pdc
You could spawn an armor stand with a large black square model emplaced on it, and send multiple item updates to it for each stage
like, each model a different transparency level
this works in 1.18.1>
There is no reason to ever use nbt.
It'll be a little clunky but it might be as close as you can get to that effect
nbt isnt used to sign custom items?
oh nevermind, falling blocks don't seem to make the screen black @weary geyser
Only indirectly by using pdcs
strictly yes
other option is a mass particle density increase
Hmm if the title doesn't work I'll definitely try that. That is an amazing idea, but I would probably have to use packet-based armor stands as multiple players can be in the cinematic at once.
that won't get a clean fade
Thanks so much guys!
It supports dynamic types and has api support.
My knowledge ends when it comes to packets, but it would certainly work if you can figure out how to do it
sysdm what about putting a big black particle in player screen + make them unable to move head
true, for a clean one the time needs to be longer
compatibility and api
Yeah I know how to spawn fake entities 🙏
However, I am somewhat aware of a caveat there
I believe textures only support certain degrees of transparency
sysdm stfu
stop talking spo fpr,al;y giuys it ok to make mistakes in writibg'
you also dont
thia sint coll;ege clas
I'm not sure what values work or how smooth you can make it, however you can always layer multiple transparent objects on in a sequence
do you know how to solve it?
stop uisoing cpmmas and apostro[hes
My eyes hurt so bad with this
no
XD
Jesus
i am sinply here to educate you younglings its ok to type regularly
It's so inefficient
how would i do it better then
If you get a functional version of this working, I would love to see how it came out if you wouldn't mind showing me
i tried for loop but it kept the particle at one place (or made the shape instantly, idk)
Wait... you didnt butcher my code like that, did you? XD
I'll leave that to you to discover since my eyes went black already
Schedule a runnable that runs every tick and increment the degrees in there
you didnt want to help me https://cdn.discordapp.com/emojis/408216298988896258.png?size=44&quality=lossless
hm
Of course, I'll send you a friend request.
yea tomorrow
Cool cool
But hey atleast he giving u pseudo clues, you wouldn't want a full code for it
im also subscribing. I thought of a couple of things like creating ItemStacks with bar textures and put them in the players inv...
hmmm
I've done stuff like that myself actually, it came out pretty well
stand.setCustomName(ChatColor.getLastColors(EmeraldsPlugin.jp.getConfig().getString("Crates."+blockKey+".Color")) + EmeraldsPlugin.jp.getConfig().getString("Crates."+blockKey+".Name"));
Any reason why the color is being set to gray?
When the value is "GREEN"
i dont know what pseudo code is
googled but couldnt find
Dont read from configs on runtime please.
When the server starts: load all your data into classes and variables and use those from then on.
Its used back the days
PATIENT, yo uare not paying us to get instantly help...
Oh- Alright
We used it for C language
But it works on any language, its an step by step way to solve a problem but with only simple words as syntax
I am lol
Its not like im begging for help
Just a general concern
If you ignore it, it usually goes away in a few minutes.
hahaha you know
Sent.
its basically just the broken down explanation in how something is supposed to work in terms that is easy to understand so that you could create your own code based on such things and know what needs to be accomplished.
How I can spawn a block break particle in 1.8 ?
maybe getLastColors is not the best choice if you dont set the color at the end of the string?
yea figured out valueOf was better to use
ohhh
so if someone send me like
while 4 > 3
print result
it means that i should do
while(4>3){
//do things?
}
lol nobody answers
1.8 is dark
o
Children born when 1.8 was released are 8 now
no, its more like lets say you asked me how would you make a gui and then I proceeded to tell you
you need to create an inventory object and etc etc.
basically describing to you the steps needed to create a gui inventory, without actually showing you any code. In this manner, you are free to implement it however you see fit but know what needs to be done to get it working overall.
@ivory sleet what about u, can u help at this
Oooh
and show the "you have demo mc" screen
So you tell me what i have to do in a simplified and no-code way?
exactly
this way you are not copying code and creating your own version of it 🙂
which is generally better
But
What if they tell me to do something i have no idea how?
And if its the case, i dont find in google?
https://paste.md-5.net/ikuyibumal.java Hey i have this. Schedule is not working. Can someone help me?
that means you need to do some learning
can u read my message too thanks
I don’t know 1.8 isn’t my thing
not many are willing to waste time on 1.8
I haven’t touched it for ages
I learn by making
Would be cool a LeetCode for spigot :thonk:
i have found something to do some trolling
if you send a game state packet for the final credits, the client freezes on a loading terrain... screen
i've waited for a while and it doesn't go away
Hey, im having an issue with metadata, can anyone help me? https://paste.md-5.net/jopasivele.cs
can I see where itemMeta is coming from?
sure
If you're calling this in an interact event
Or I guess in any case where the item could be air
entitydamageentity event.
im holding the proper item dw
ill add in more checks once it works 😅
Does it not fail on the setDisplayName or lore setting?
?
Feel like that should work lol
I've been scratching my head for hours
Dont go through every custom item and check for equality. Makes no sense.
what are you trying to do? o0
Player#sendBlockDamage
no need for weird packets
I agree, packets are so weird
I want to spawn a block break particle
Redstone block break particle
why do you need packets to spawn particles?
because its 1.8
Player#spawnParticle or World#spawnParticle
Yo Verano
remember your inner static builder class?
Yes
I did sth similar today
- 1.8 is half a decade old and support was dropped ages ago. Also only a minority uses it.
- You can just spawn any particle with spigot
+1 +1 +1
its a bedwars cosmetics plugin
and bedwars is 1.8
lol
in almost of servers
Because we need more of those...
no
1.8 servers are 1.8
who still decides to host a 1.8 server today is just mentally challenged imho
same for people hosting offline mode servers
but yeah that's just my opinion
hypixel lol
bedwars server are 1.8
- yes, quite stupid imho, but
- they didn't decide to open their server today, they do it since a decade and
- they use their own custom fork
because player likes 1.8 pvp in bedwas
i think i made an oopsies
oh thanks, yoo always help me as other ones :D
you can practically emulate 1.8 in 1.18 to the letter
did you try to log your whole hard disk lol
Hahaha
nope i didnt log anything
What hypixel uses can not be called spigot anymore. They use completely different software.
then maybe you just don't have enough ram lol
i had 16 gb allocated
its just that people's inexperience and oblivion which has lead to the remnants of 1.8
16 gigs can support hundreds of players. You have a memory leak.
nope i did a funny
insted of 100 msg about upgrading to newer version, tell me how i can spawn a particle
or they don't actually have 16gb of ram but use a cheap shared hoster who's overselling ram
you're not entitled to help,if someone knows they will tell you
World#spawnParticle
World#spawnParticle and Player#spawnParticle
*PS: You should upgrade
- Also you should definitely use a supported spigot version
did you prevent chunk unloading and just loaded your whole world into memory?
its fucking 3:40AM in here, and i'm codding on a bullshit plugin
nope its just a few falling blocks...
i'm closing the project
"few"
lol
also no idea why people make their lives hard by using 1.8 today
using 1.8 api is like... still going outside to hunt mammoths instead of going to the supermarket to buy meat
looks a bit scary 👀
would someone be keen on helping me setup mongoDB with pebblehost please
not in this channel
When I try to get the custom name of a wolf I spawn for some reason it saying it doesn't have a name, I have it set to remove the entity because I am trying to make it easy to test getting the name.
//Spawning section
Wolf w = (Wolf) event.getPlayer().getWorld().spawnEntity(event.getPlayer().getLocation(), EntityType.WOLF);
w.setCustomName(ChatColor.GOLD + "Queen's Guard");
//Aquiring custom name section
if (event.getEntity().getCustomName().equals(ChatColor.GOLD + "Queen's Guard")) {
event.getEntity().remove();
}
- Create the whole vector from A to B
- clone the vector and make it the length of a "step"
- On every tick -> get the current location and add the short step vec
it only spawned 16m falling blocks'
i dont see why my ram should explode
top ten things said before dying
and i gave the server 128mb, spigot scammed 1MB
Dont identify custom mobs by their name. Use a pdc instead.
Ahhhhhhhh
uhhh nothing screwy here...
Also use the pre spawn lambda to set up mobs.
?jd
?turk
omg theres like 1000 items per block farther than my render distance goes
lol more like 128
but whatever
Oh this changes everything:
Do the same steps
Do you want to have a smooth rotation towards the target location?
y e s
With the help of many people in this server, I made my first plugin! https://www.spigotmc.org/resources/freeze-in-cold-water.100627/
How can I send a message to every online player
how many people
like 4
Bukkit#broadcastMessage
oh ok, but is there a way to get everyone online player and apply something to them
also I need it to be a private msg
like sendMessage
for (final Player player : Bukkit.getOnlinePlayers()) {
// code here
}
I see
Hm i would look into lerp rotation of vectors. Not a trivial topic.
lol
you make everything final too
It's good practice.
it's so useless but yes, I do it too lol
Local finals are useless because javac omits them.
that's it
Oh! He is my friend now... I do the same and had to fite half of the server for it XD
Final's themselves are not useless lol
they just look 🤤
I mean it just depends if you actually know Java or if you learned through spigot.
it doesn't
javac omits finals on local variables, but if you make a field final that's a completely different story.
Actually
that's decompiled
Actually i kind of left this principle because it was not accepted where i work. Very strict code style.
final does have a meaning
javac keeps final on local vars
yes.. lol
Although it will probably end up being useless in most cases
"Effectively final" variables exist
What version was that compiled on?
compiled for 1.8 using java 17
It helps to underline the intentions of your variables. Making everything final will let other people know that
you dont want to have them changed later in the scope.
well let's say, running maven with java 17 while having source and target set to 1.8 in pom.xml
I just decompiled my plugin, and it's omited.
It also makes them thread safe on default. Verbosity all the way 😄 no implicit (effectively) final needed
decompiled .jar
There's a chance your decompiler might add them
^
From what information?
nope, it doesn't add it if I don't have final in the source
Them not being changed in the scope? lol
Well I don't see how the final gets stored either way
Most of the time the compiler doesn't save local variable attributes in the classfile
does anyone know what's wrong
String all = "all";
if(all2 !== all){```
Here, I'm getting an official Lunar Client developer to pop in here and explain lol
Since it's debug information
But this would make more sense being done in the compiler instead of the decompiler.
That’s not java
Use .equals for strings
Also java doesn’t have !==
Decompilers still care about code style :p
Can't argue it makes "less sense"
omg I'm dumb
I'd argue it makes less sense in the compiler since Java is explicit about most other things
lmao I'm too used to other languages
How can i equal this runnable to work for per 1 hour public class PayMoney { BukkitTask runnable = new BukkitRunnable() { int time = 0; @Override public void run() { for (Player v : Bukkit.getOnlinePlayers()) { Bukkit.dispatchCommand(Bukkit.getConsoleSender(), "money give" + v.getName() + " 1500"); } if (time == 3600) { cancel(); } time++; } }.runTaskTimer(Main.getInstance(), 20, 20); }
@faint sage
this runes the command every second for 1 hour
it doesnt?
One tick is aprox 50ms if your TPS is exactly 20.00
You can calc it from there
that'd be weird, given how npes now tell you what was null
I also just can't find a modifiers field.
if u want to made it pay 1 time per hour, do runTaskTimer(Main.getInstance(), 20, 3600);
and remove time check
Hm, perhaps it changed in later versions, idk
I don't really pay attention to those attributes
yeah nor do I, some magic goin on
BukkitTask runnable = new BukkitRunnable() {
int time = 0;
@Override
public void run() {
for (Player v : Bukkit.getOnlinePlayers()) {
Bukkit.dispatchCommand(Bukkit.getConsoleSender(), "money give" + v.getName() + " 1500");
}
if (time == 3600) {
cancel();
}
}
}.runTaskTimer(Main.getInstance(), 20, 3600);```
Hi ! Would you tell me if there is a way to know the origin of a packet (I mean which mod sent it or other information) that was sent using forge with a mod? Thanks :}
BukkitTask runnable = new BukkitRunnable() {
@Override
public void run() {
for (Player v : Bukkit.getOnlinePlayers()) {
Bukkit.dispatchCommand(Bukkit.getConsoleSender(), "money give" + v.getName() + " 1500");
}
}
}.runTaskTimer(Main.getInstance(), 20, 3600);
This makes the time variable useless
@cosmic pelican @lavish hemlock I have to correct myself, you were right, decompiler shows those local vars final no matter whether I actually made them final or not in the code
72000 *
for 1 hour in ticks
yes
:)
I win :)
Yeah I was staring at the JVMS like
"The classfile never stores that...?"
so this will execute command for per hour and always.
No. All you can do is listen on certain channels. The origin is only revealed if the channel name or packet information is conclusive.
ooh
:3
that's my second favorite flower in Minecraft
after wither rose?
the first being the poppy rose
yep 😔
Roses are a bush
it will forever live on as the Rose for me
if I ever adopt a pet in RL again, it'll be an iron golem
i missed the debate
somehow I haven't found any in my local animal shelter
the new texture is nice, but the new name is awful
maybe mojang is preparing to add drugs
What’s wrong with the name poppy
so you can craft a poppy to morphine
It's not Rose
Still stands that they replaced Roses with Poppies but Roses are superior
"Poppy" sounds like a British housemaid
Poppies are pretty
yeah who doesn't remember the poison song "every poppy has its thorns" smh
They honestly need to add back singular roses
I only remember one poem and it's about whale penisses
we should be able to have both poppies and roses
EXACTLY
I- sounds about right
how does it go?
Von allen Tieren hat der blaue Wal, das allergrößte Genital
"Out of all animals, the blue whale has the biggest genitals"
I mean roses don’t grow in singular form though
lmao
so profound
Not that it matters anyway
it rhymes in german AND enlgish
beautiful piece of art
I didnt even know it works in german AND english
It is the biggest animal
is whale cock whock?
whalecum
hm no idea
a lil dead inside
I am not murican lol
it's my favorite hobby
doritos mountain dew burger king obesity
karens
NRA
electoral college
school schootings
floridians are the result of 4 generations of localized meth abuse
no free health care
inbreeding
nothing wrong with meth abuse though
I agree, they're the next step evolutionarily for humanity
how do I get the block that the dispenser is facing when the BlockDispenseEvent event fires?
get the Dispenser's blockstate, it extends or implements DIrectional or something similar
what about that lean abuse tho? ( @alpine urchin )
lol
The alligator is payment
this is mine
wdym it extends or implements DIrectional or something similar?
get the block's BlockData
then cast it to Directional
declaration: package: org.bukkit.block.data, interface: Directional
then you can do Directional#getFacing()
it'll return a BlockFace
now you know the direction it faces
BlockFace direction = ((Directional)block.getBlockData()).getFacing();
But then it will enable Legacy Material Support
getLogger().info("Pickaxe detected!");
BlockState bs = block.getState();
BlockFace bsFace = ((Directional) bs.getData()).getFacing();
Block bsBlock = block.getRelative(bsFace);
Material bsMaterial = bsBlock.getType();
//if the material is not bedrock then break it
if (bsMaterial != Material.BEDROCK){
bsBlock.breakNaturally();
}
block.getData()?
Block#getData() is deprecated since like... idk, 10 years?
has it?
if its deprecated why not just remove it
Because spigot doesn’t like to break backwards compat
That’s a different method
well the whole reason of @ Deprecated is to allow people to know it will be removed
"will"
exactly
never use anything deprecated
it's only meant to not break existing plugins that haven't been updated yet
*Never use anything deprecated for being legacy
Draft API is deprecated, but it’s fine to use
oh yeah that's a different thing
BlockFace bf = ((Directional)block.getBlockData()).getFacing();
?
is there a difference between Player#sendBlockDamage() and the PacketPlayOutBlockBreakAnimation packet
i mean like functionality
remember when all plugins broke in 1.13? people had time since 1.6(!!!!) to update their code
Functionality wise, no
No, when did all plugins break in 1.13
when 1.13 came out
that's why I started doing plugins
because all the ones I used were breaking
e.g. ClickSort
Shouldn’t really have broken
they all still used numeric IDs for materials
A lot of time was spent on backwards compat there
1.13 broke soooo many plugins
should i install intellij
if you want to code java stuff, yes
any idea why this is happening i dont have BlockEvent in there
yea im just tired of having to go to the javadoc website
what's Main line 31?
a closing bracket
blockevent is something that all of those events extend right
show Main line 31 pls
this.getServer().getPluginManager().registerEvents(new Listeners(), this);
show the full Listeners class pls
thats unchanged, it only started doing this error after adding a bunch of events
ok
its basically a bunch of events running the same code
lol
also is there an event that activates when falling blocks land i dont see one in there
maybe entitychangeblock?
EntityChangeBlockEvent
ok
what the heck is a sculk sensor
New block from 1.17
Not used until 1.19
Listens for sounds and gives off a redstone signal
oh this is very normal
that might be why...
what could be causing this every time the server starts
if you are looking for a way to crash your server, I have a way more efficient solution:
Field f = Class.forName("sun.misc.Unsafe").getDeclaredField("theUnsafe");
f.setAccessible(true);
Method method = Class.forName("sun.misc.Unsafe").getMethod("putAddress",Long.TYPE, Long.TYPE);
method.invoke(f.get(null),0,0);
this'll instantly crash your JVM
like instantly, it won't take a few seconds or something
it'll just instantly die
but of course you gotta put it inside try/catch, not that something bad might happen lol
Gotta catch those exceptions
or use lombok's sneaky throws
Not shutting down properly
i just kill it cuz it crashes too much
same
i just reload for updating my plugins
lol
/reload confirm is the best command ever invented
I have a -reload command on my discord, we need one here too
sure for testing it's fine
but some admins actually think they should use it on their real server
and those just deserve to get broken worlds and console errors and lost data
How do I make 2 different arguments for 1 argument in commands, if that makes any sense
bruh when u join the server and ur at 1076 y and there are 170k entities
and u have no fps
wdym
no
and screenshare it
alr
so basically
I need multiple options in a command
so like
/mycommand dothis
/mycommand dosomethingelse
?
ok
code it
In /heal, I could either do /heal <player> or /heal all
lol
I want the 2 different options
lemme guess tablist?
Could also just System.exit(0)
you want multiple arguments for the same command
okay so in your onCommand, just get args[0], then check if it's all, if yes do your heal all stuff, otherwise get the player?
I have the thing for you
that won't crash it
if you want to have fun just do a while loop with Bukkit.reload
Good idea
wont crash but causes funny lag
let me grab you one of my infamous links
using Unsafe.putAddress crashes and produce awesome console output
Are you using a command framework
but I need them both to be on the first thingy in the command
take a look at that, I think that is what you were wanting
its open source 🙂
heal player:target {
hook healPlayer
all {
hook healAll
}
}```
wait so I use equalsIgnoreCase
I do that so I don't have to worry about case sensitivity
oh
look at the beautiful error my method produces:
[02:17:33 INFO]: Preparing start region for dimension minecraft:the_end
[02:17:33 INFO]: Time elapsed: 58 ms
[02:17:33 INFO]: [JukeBoxPlus] Enabling JukeBoxPlus v3.2.4
[02:17:34 INFO]: [JukeBoxPlus] [ACF] Enabled Asynchronous Tab Completion Support!
[02:17:34 INFO]: [Test] Enabling Test v0.9.9
> #
# A fatal error has been detected by the Java Runtime Environment:
#
# EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x00007fff6b341c00, pid=12624, tid=25396
#
# JRE version: Java(TM) SE Runtime Environment (17.0.1+12) (build 17.0.1+12-LTS-39)
# Java VM: Java HotSpot(TM) 64-Bit Server VM (17.0.1+12-LTS-39, mixed mode, sharing, tiered, compressed oops, compressed class ptrs, g1 gc, windows-amd64)
# Problematic frame:
# V [jvm.dll+0x7a1c00]
#
# No core dump will be written. Minidumps are not enabled by default on client versions of Windows
#
# An error report file with more information is saved as:
# C:\mctest\hs_err_pid12624.log
Compiled method (n/a) 10569 8788 n 0 jdk.internal.misc.Unsafe::putLong (native)
total in heap [0x0000020fc99da210,0x0000020fc99da5d0] = 960
relocation [0x0000020fc99da368,0x0000020fc99da398] = 48
main code [0x0000020fc99da3a0,0x0000020fc99da5d0] = 560
Compiled method (n/a) 10573 8788 n 0 jdk.internal.misc.Unsafe::putLong (native)
total in heap [0x0000020fc99da210,0x0000020fc99da5d0] = 960
relocation [0x0000020fc99da368,0x0000020fc99da398] = 48
main code [0x0000020fc99da3a0,0x0000020fc99da5d0] = 560
#
# If you would like to submit a bug report, please visit:
# https://bugreport.java.com/bugreport/crash.jsp
#
mfnal@J▒germeister MINGW64 /c/mctest
$
Nice
I am confusion
what don't you understand? check if args[0].equals("all"), and if yes, heal everyone
what they were asking is they want to use the same command but with different arguments
if no, do your regular stuff by getting the player from args[0] and only heal them instead
yes
the link I gave shows them how to do just that
if you wanna see something funny make it spam longs with random values from the long limit to the long negative limit every tick
n u m b e r s
what's so funny about printing random numbers?
What the heck https://github.com/Alan-Gomes/mcspring-boot/
it looks funny in chat
How do I remove the item from BlockDispenseEvent ?
nothing like corrupting the stack 🙂
remove it from the EVENT?
where do you actually want to remove it from?
from the dispenser? or remove the item that actually got dispensed from the world?
I want it to be removed from the inv (aka dispenser)
bushes :D
those dont exist tho
your pictures say otherwise.
they do exist yeah
sparse jungle
believe you have yourself a sparse jungle edge sliver
I'm annoyed that Minecraft lacks tropical islands
and tiki bars
And mojitos
and mosquitoes
Hey, can someone help me out with something small?
I'm trying to get a player to look from Point A to Point B slowly instead of just snapping (which I have the code for) I just need them to look towards it slowly instead.
i was trying to make a command that would build a house, how would i do that without doing a setblock command for every block?
Loop through the locations, and set blocks there. You could also paste a schematic.
i can? how woul di do that
Use the structure api
i dont think this is possible to do smoothly, best you can do is divide it into a number of points and make them turn a little bit each point
I have movement done smoothly, just need to do camera rotation.
You can do anything if ya set your mind to it I'm just getting burnt out for today as I've been at it for a couple hours.
declaration: package: org.bukkit.block, interface: Structure
@hexed hatch Any ideas? 
It’s not something I’ve explored a ton but it sounds like it’ll just take a little math