#help-development
1 messages · Page 1943 of 1
there is damages and then there is restitution
and what would be the result of such a lawsuit? that the judge says "okay you werent allowed to do that", and then?
they would most likely be awarded restitution
but for what? in germany that would mean "give back what you "took away" from them", which in this case is 0$
but yeah in USA it's probably very different
restitution is basically a penalty but paid to whoever won
I'd actually say that optifine made minecraft more popular
So restitution is awarded where damages are not
weird situation imho
I’m still glad optifine is finally getting replaced
I'm not 😄
I like optine. one click and it's installed, it works fine, it has a thousand more options than iris etc
And doesn’t it use adfly garbage links too
I don't care as long as it works
not if oyu click on "mirror" to download
I don't use optifine 😛
tbh starlight sodium combo is pretty unbeatable
I don't use it too but if i'd actually play, I'd get optifine
I generally don’t use anything because my game runs fine
I just use the vanilla client
but shaaaaders
whuuut
use appropriate JVM arguments and generally good to go
I’ve never found one that doesn’t make everything painful to look at
yeah you have to tweak the settings of course and yeah it sure does make it harder sometimes
but it just looks so awesome
sildurs
Oh you’re next to a sea lantern? You’re blind now
you have indeed a powerful computer
almost all shaders let you tweak the difference between brighest / darkest
that's a screenshot from google
oh..
Sure but why is the default flashbang
but I guess i'm fine nonetheless 😄
never been a fan of shaders really
considering most don't work on my computer anyways
shaders probably suck if you like pvp etc
but if you just wanna build a nice awesome city on top of a snowy mountain
then it's just a whole new level to have shaders
Game doesn’t need to look super ultra hyper vibrant and realistic
I don't like pvp. PVP is implemented in quite a dumb way that it makes it not very fun to do at all
beautiful ≠ realistic
it doesn't need to, but I like it more if also looks better
it does look better tbh
well, shaders do no good if you can't use them to begin with 😛
yeah my macbook would explode
the extensions required in most shaders simply don't exist for me
if I ever want to become a terrorist, I just board an international flight and then run minecraft with shaders midflight on my macbook
so it isn't that my client would lag just outright wouldn't run XD
it wouldn't do anything to the aircraft
Fabric
it would explode and kill everyone in a 50 meter radius
lol, laptops don't have that much explosive power
it will explode and kill everyone in render distance
a macbook running MC + shaders has
mine almost explodes just by running 2 MC instances without shaders
source? because 50 meters is quite a distance and I only know of a few things with that much explosive power and they are not batteries lmao
figurative language
I don't have a source because my battery always died before it could unleash its power
Your battery is an anime protagonist
you know, macbooks not only explode with a 50 meter radius, they also are empty within 7 minutes
Batterizhu
I don’t understand why laptops keep getting more storage space
Do you know how heavy they will get once you fill a 1TB hard drive
lol exactly
aint nobody's biceps be able to carry a whole terabyte of hentai
oh shit almost 6.30 am
4GB of data weighs approximately 0.000000000000000001 gram
imagine how heavy 8gb must be
I mean technically you would have to imagine it because we don't have measuring devices to weigh at such fine levels. I mean we do, but you are not going to be able to afford such things lol
I wonder, if a bag is too heavy for a flight (limit here is usually 23kg or you have to pay extra)... why not just fill it with some helium
well, helium is flammable first off and second it is a gas
Airplanes are already completely filled with helium, that’s how they fly, no room for any more
not sure how other countries will treat that, but in the US you won't get very far with that 😛
aaah that makes sense
Hydrogen works too
ah right was thinking of hydrogen
Makes a great zeppelin
I know that because I had a helium tank at home for 2 years lol
a friend brought it once and then it was left here for 2 years until I just dumped it outside in the night
are you not allowed to have a hydrogen tank?
I mean technically you can have gas tanks of almost any kind in the US
what I do know is that you are not allowed to use your garage for stuff other than to put a car inside
that's perfectly fine, you can buy it at any supermarket
but this is actually true
Weird thing in Germany
the reason is that building permits for garages are only valid for "garages" and a garage is a place to store a vehicle
if you want to do other stuff you must not declare it a garage
and then it's harder to get a building permit
Can I store a tank
in the US we tend to put a bunch of stuff in Garages other then vehicles 😂
yeah sure everyone here does it too
I doubt anyone would mind but e.g. if you only put a billard table inside, that's technically not allowed
if everyone does that, then you would think they would update their building code stuff to match what people already do with it
Does it specify only certain types of vehicles
I once read a lawyers opinion on garages and they saw
"it should probably be fine as long as a car still fits inside"
no and I doubt that anyone ever will get in trouble for it
can't argue with that assessment
Good, I need a place to store my b-52 bomber
in theory you can get a fine up to 500€ for abusing your garage lol
what is considered abusing your garage?
Slapping it
nah as said, putting so much other stuff inside that a vehicle doesn't fit there anymore 😄
but one could argue that a bicycle still fits inside and bicycles are vehicles
Does it have to be a real car
no one will know so as long as you don't open the garage door 🙂
What about a nice toy car
they can't transport persons and so they are not a vehicle I guess
yeah and even if, noone would ever care
have you seen toy cars?
well the ones in the US can actually take you like 5-10 miles
oh if you talk stuff like bobby cars... hm
technically even a bobby car would be a vehicle
Oh yeah those exist
to find out, just get a bobby car and drive around it while being black out drunk
I was planning to drive my hotwheels to work
if police now fines you for drunk driving, at least you can claim it's a vehicle if you get the 500€ garage fine
so it's a win win
either you can blackout drunk drive a bobby car or you can use it to cheat on the garage permit
Instructions unclear, rode on the shoulders of a man named Bobby
I guess you'd have to search a long time before you find someone named bobby here 😄
we are all called HEINRICH
I can bring my own
What a nice family
and the photos were only 250$
PS1 faces on PS5 bodies
Either way, they got their free PR
Absolutely stunning licensed black range Rover Evoque kids sports car with working lights, MP3 player input and all other functionalities your child can dream of. It features a 12v-rechargeable battery with two forward speed and one reverse speed and full function remote control for parents whose...
with mp3 damn!
Lol the review
I hate it when my white Range Rover turns out to be a red BMW
onPlayerJoin returns non-void type boolean. This is unsupported behavior and will no longer work in a future version of Paper.
```Ello and good day, what is a non-void type boolean and how would I go aboutt patching this?
use void
You are in spigot discord
public void onJoin(PlayerJoinEvent event) // ok
public boolean onJoin(PlayerJoinEvent event) // works but not good
Yes
are there any other good ways to make foliage like custom blocks other than tripwire?
foliage?
like cross models
I don't understand
Am I supposed to be using getSerializable for deserializing a yaml config to a class.
grass, flowers, plants
foliage would be things like bushes, grass etc
yeah what does that have to do with tripwire
I just would rather not use tripwire if there is a better way
See above
deserializing a yaml to a class?
you need to replace an existing block to have custom blocks
I can’t think of any better block to use
you want to use Bukkit's ConfigurationSerializable interface
most popular plugins use mushroom blocks or noteblocks for custom textured blocks
never heard of tripwire being used for this
(with most popular i mean itemsadder, oraxen etc)
I use mushroom blocks but you dont want to use them for anything smaller than a block
I must be using it wrong because getSerializable doesn't call deserialize in my class
you have a custom class and you want to save that in a yaml, then load it again, right?
did you also register your class to be seriazable?
no collision and it wont turn let you see through the ground
ConfigurationSErialization.register or sth
Yeah its in my onEnable
I think I actually just came up with a idea to replace it
Do share
you should be able to do
MyCustomObject something = getConfig().getSerializable("path-in-yaml",MyCustomObject.class);
Thats the issue, it returns null
can you show a config containing your custom item?
Idk what that syntax is, double check the docs
I think im gonna use custom blocks on the ground for this specific situation with the x model above them using blockbench, then put a structure void there or something that wont interfere with the player but I can test for using the player interact event
only really works for my specific situation
Just get() definitely works
Assuming you implement Serializable and have a deserialize method or construct
Don't think it's generic though. getSerializable() returns T
items:
ruby:
display-name: "Ruby"
type: "basic"
ConfigItem configItem = getConfig().getSerializable("items.ruby", ConfigItem.class);
getLogger().info(configItem.displayName);
Registration is only necessary if you want an alias I think
ConfigurationSerializable*
Custom serializables dont look like that
yeah and T is the type of the class given as 2nd parameter
They need an == with the class
If you want it to look like that you need to deserialise yourself
yeah it must look like this
deathCause:
==: de.jeff_media.angelchest.data.DeathCause
damageCause: VOID
killer: null
Copy the output of set(..
as md_5 said, you are just saving it as normal ConfigurationSection. Get one of your items and save it to some config, then see how it looks, or do it like my yaml above and add the ==: <class.name> part
md I wonder
why is == even needed if getSerializable() takes a Class object anyway
Isn't that what this line does..? https://gist.github.com/tomgie/19ca236125b548dba76ebcc31cd77dce#file-concreate-java-L26
this method simply takes "the configurationsection" and turns it into your object. but bukkit itself won't call this method unless you actually have the == part in the yaml too
I guess that ==: "your.class.name" tells bukkit which classes' deserialize() method to call
if you want to get rid of the need for the ==: your.class.name part, you have to write a method that simply takes a configurationsection and does the same thing as your current deserialize method, and then do stuff like
MyClassObject myThing = MyClassObject.deserializeFromConfigurationSectionOrHowEverYouWantToCallThisMethod(config.get("path-to-your-section"));
Yeah thats what I was doing before but it seemed like an out of the way method
Guess not
if you want your stuff configured by humans, go for the "own method" way
if you just want to store data that isn't meant to be changed, use the ConfigurationSerializable
because most admins will be confused by the ==: part
how to share variable to other file? public and static dont works (noob in java)
?learnjava Pro tip read one or more of these
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.
Getter
?learnspigot
java.lang.NoClassDefFoundError: org/json/JSONObject
how to fix it?
how tho? so other people can fix
Anyone know how would I import this https://github.com/anhcraft/confighelper library into my maven plugin?
oh
I somehow made it
but would like to hear how's it done correctly anyway
hello I just finished updating a plugin I was making to add new features
My plugin's name is StonecutterWoodRecipes but the actual jar file after compilation is always marked as StonecutterWoodRecipes-1.0.jar
I'd like to change the naming convention for it to say StonecutterWoodRecipes _1.1.0_1.18.1.jar is that possible without creating a new project?
I'd prefer not to create a new project as my plugin folder is already a git repo and I'm doing version control with that
here's my project tree if that helps to illustrate my point
oh...
I already checked but I didn't see it
checked again rn and yeah found it thanks
do yall know when a mob/player turns red and theyre invincible for that period
is there a way to change how long that period is
why
@EventHandler
public void onItemPick(EntityPickupItemEvent e) {
e.getEntity().sendMessage(e.getEntityType().toString());
}
``` is not giving any output
maybe cast e.getEntity() to a player object
still not works
and check if its an instance of a player first
Did u register the event?
r u implementing listener in the class
.
oh
if the event is not working should i work with netty and packet listening ?
how do i check if an item has an itemmeta but ignore its durability
without making it unbreakable
bad wording
check if its item meta is equal to another items item meta
cuz its a sword
and u use a sword
and its item meta is apparently different when it has a different durability
its fine i fixed it
why would you compare ItemMetas anyways
to check if its the custom item im trying to use
i have an items class with all the custom items in the plugin
?pdc
and im comparing if the item the player is using is the same to the item in the items class
That's not even his issue. And if it was just use player pickup event
i done it, didnt work
didn't work
i done another thing not related to drops
i ignored the drops
nvm
guys i might be a fucking idiot but i need help with a concurrent modification exception
so i have this arraylist that im modifying every tick for every item in that array list
it has a constructor with a player an int a location and another location
basically every tick im making that int go down by 1
but when theres multiple things in that list at once it does the concurrent modification exception
when theres multiple things in that list at once basically when 2 players have fired this custom weapon at once
How about showing the code and the error
https://pastebin.com/PETuictR
Task #60 for TerrariaSwords v1.0-SNAPSHOT generated an exception java.util.ConcurrentModificationException: null
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.
soz for shitty code lol
im gonna try changing the lists AFTER the for loop
cuz i read that u cant modify it in the for loop itself
If you're just removing use removeif
how do i do i use removeif for my contructor
nvm
i still dont think thats gonna help
with the concurrent modification exception
Do you know why a concurrent modification exception is normally thrown
ive read that
````Note that this exception does not always indicate that an object has been concurrently modified by a different thread. If a single thread issues a sequence of method invocations that violates the contract of an object, the object may throw this exception. For example, if a thread modifies a collection directly while it is iterating over the collection with a fail-fast iterator, the iterator will throw this exception.```
array list is not thread safe
what IS thread safe
Collections.synchronizedList(new ArrayList<YourClassNameHere>())
you need to have it synchronized so that no matter what thread is modifying it only one thread at a time will be able to do so
:(
I wonder if it got changed or moved
nope it didn't change
declaration: module: java.base, package: java.util, class: Collections
declaration: module: java.base, package: java.util, class: Collections
Collections.synchronizedList is a static call
shouldn't need to assign it as an object value to make use of it, they probably just didn't import it
i did
ok lets see if this works
well it is the only thing I could see that would throw CME right away
other then some of the API not being thread safe
just use offline mode and log another client in
i dont have another account
don't need another account for offline mode
one of the acceptable uses of offlinemode 🙂
client doesn't care, but generally need a modded client to change the name
the client itself doesn't need to be offline, but to use a client without logging in like that you need to use a modded client
vanilla client doesn't allow changing the player name for offline mode which is technically just singleplayer mode according to the client
lol
EventPriority.LOWEST means event will do its work first?
Also just a Java question
Does break;ing out of a for each loop break it out and cancel it for every other item in the list
I’d assume that the event would happen last
ok ._.
in stackoverflow I found that, low will call first, high will call after low and monitor will call in last
happen first, because they have the lowest priority in deciding the outcome of the event
you cant break in foreach loop
i found out continue; exists
which breaks out of the iteration its in and goes to the next
but you also can't continue in a foreach loop
how and why not
Yeah also overrides falsy iterations like while (false)
cuz thts dumb
foreach isn't a loop
it is?
well how do i end the iteration then
unless you are talking about
for (Integer i : lst)
i am
Yeah
talking about that
ah ok
can we cast getEnchantments as enchantment class?
that is a foreach loop or better known as an enhanced loop. You can break out of it
You said here it wasn't a loop
i was referring to .forEach() of Iterables
well, it is a loop but the function you passed into it isn't
so I'm also wrong in that
well it is an iterable foreach and not quite the same as an enhanced for loop lol
yes
it is also not a replacement for such either if some think it might be 😛
two advantages I know of that the iterable foreach is good for is atomically iterating over a synchronized list and parallel execution
How can I get player's held item with PlayerInteractEvent?
public void getHeldItem(PlayerInteractEvent event) {
ItemStack main_hand = event.getPlayer().getInventory().getItemInMainHand();
ItemStack off_hand = event.getPlayer().getInventory().getItemInOffHand();
ItemStack iteracted_item = event.getItem();
these 3 ways that I know of
if you were to look at the javadocs this would have been fairly obvious
?jd
Enchantment ench = (Enchantment) Objects.requireNonNull(e.getView().getItem(16).getItemMeta()).getEnchants();
why this code produces error on my server
I have a plugin that makes wood recipes for the stonecutter since there's no woodmill block
The plugin works just fine and the recipes are loaded correctly
my only problem is when the /reload spigot command is executed it somehow breaks my plugin and no recipes show for wood blocks afterwards
before reload:
and it was that
after reload:
ok hang this seems like a client issue because it actually works the client side doesn't see the recipes after the reload
and to see the recipes the client needs to disconnect from the server and log back on
i guess the server doesn't send the custom recipes I made when I reload.
does somebody know how to change that behavior?
If you /reload you have to get all online players and expose the recipes to them
alright so how would you go about this?
I just don't know how to "expose" recipes
does that have to do with it?
plugin.getServer().addRecipe(new StonecuttingRecipe(new NamespacedKey(plugin, resultMaterialKey), new ItemStack(result, amount), source));
alright thanks and also is there something like a onReload method that I have to Override ?
i guess i dont really understand how the /reload command behaves
no, in onLoad ( if (Bukkit.getWorlds().isEmpty()) reload = false)
then in your onEnable check your reload value
i've tried with these:
event.getItem()
player.getItemInUse()
I am trying to detect right click
how about event.getHand() ?
and if item is x i do smt
lemm try
thats not what you asked
you didn;t ask that in teh last few minutes
Is there anyway to auto update config.yml?
if (event.hasItem()) event.getItem()
saveConfig() ?
like I added something new in next version of my plugin's config.yml. and when user put update jar in server, it will add/edit new key in config.yml
set copyDefaults(true) then set your new config as default
in what way would you like to auto update it?
do you just want to replace the file?
or do you actually want to update the contents of the file without wiping away user settings
keep old key values and add new keys
get all the configuration settings, set the old ones to null
then set new options then save
setting a configuration or a configuration section to null, removes it from the config
if you are not removing entries my method is correct
ok thanks
the link I gave you actually deals with 2 files
moves data from config.yml to data.yml but the concept still applies for what you are wanting
Hey I had a question with Maven. I am using the Maven Source Plugin in order to create a sources jar. However, I am using Maven Modules to compile multiple modules into one (working with NMS so made an adapter). I was wondering if there was a way to automatically shade all the sources into the same sources jar.
just add the sources plugin to the dist module
erm sorry I meant root module
Thats the issue, it creates source files for every module seperatly
but it does not combine them all into one big source file
source jar*
hm right, I also just noticed
i'll take a look at the sourc plugin, maybe there's some option
mvn javadoc:aggregate
erm
source: not javadoc
try that on your root pom
works for me. the NMS stuff are submodules and the rest is the core submodule, and this is the result of mvn source:aggregate on the root pom
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<executions>
<execution>
<id>attach-javadocs</id>
<goals>
<goal>aggregate-jar</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<executions>
<execution>
<id>attach-sources</id>
<goals>
<goal>aggregate</goal>
</goals>
</execution>
</executions>
<configuration>
<excludes>
<exclude>com.allatori.annotations.**</exclude>
</excludes>
<includePom>true</includePom>
</configuration>
</plugin>
you need to create a module where the last step is essentially to shade everything
I hate how windows disallows to delete opened files
Linux has a if you want it gone you want it gone attitude
yeah that's how I want it to be
it isn't so much as that windows disallows you, you have to think of everything as a process
explorer.exe is a process that for the most part lets you see directories and files in a visual manner. When you right click to delete a file that is opened by another process, explorer.exe essentially does not have the permission to delete it
you can if you really wanted to, forcefully delete files that are opened
player#getInventory#getIteminMainHand or offhand if u want
hey um
what if the 2 plugins depend on Library A
Library A latest version is x
first plugin, depends on the library a with version y
second plugin depends on the library with version x
will there be an error?
Depends on what changed in between versions.
not so much
Hi guys! I have an inventory with some custom items, i wanted to make this items to update And get the right item meta from the plugin and set it back to the right position in the inventory, so if i modify a custom item, a user that has already that item will get the new version of it
how do I use launchProjectile()? what am I suppose to put for Class<? extends T> projectile
a class can be Arrow.class or Fireball.class or Enderpearl.class
Sheep implements Colorable so you can call sheep.setColor()
World#spawn() can either accept a Consumer<T> (where T is the sheep) or will return the entity as well you can call methods on
world.spawn(location, Sheep.class, sheep -> sheep.setColor(DyeColor.RED));```
ok ty
oh and can you deserialize them afterwards
yes
it returns Map<String, Object>
you put this inside set method inside ConfigurationSection
you can output this in either json or yaml
your own library or someone else library with some modific
so does that use any of the default bukkit config sys
it only depends on NMS NBT Tags
1.18+ or what
im running this on 1.18 it should work on older versions tho if the fields would be mapped to obfuscated ones
you can add your own custom nbt tags inside config too
and im pretty sure this would work on entities too
is there a way to get the timezone of the player?
rce exploit
maybe
if you use geoip
you can get IP location of origin country
and by country get the timezone of the player
vpn momento
that's not his problem
i was wondering how some servers display their time in the players timezone
please
check some event
inv click i guess
compare the meta
and set it back when neccesary?
but the question is how do i set an item back to its original position?
like, i can simply add it but that will not count the order and its ugly
you want to set it on its original position?
idk what you mean with original position
i can get the contents of the inventory but when i modify an itemstack how do i know where it was in the original inventory?
Slot
In this example I am getting the values the closest to 6 ordered (rank). 3 is the closest one to 6. I only want the rows with the closest value visible. So that means I only want rows visible with rank 3 here
SELECT *, FIND_IN_SET(rating, (SELECT GROUP_CONCAT(DISTINCT rating ORDER BY rating DESC) FROM currentseasonratings WHERE ranked = 1)) AS rank FROM currentseasonratings WHERE ranked = 1 HAVING rank BETWEEN 1 AND 10 ORDER BY ABS(rank - 6);
Jeez that is something
I want to make a plugin that makes every sheep a jeb____ sheep. For some reason the sheep does not change color but has the jeb_ nametag. I have also tried to keep changing the color in a while true loop but then my server crashes. Is there another solution?
is it possible to check when a player right clicks while holding a item what item it is?
i dont know how to solve this but changing colour manually won't make the jeb__ color effect, since there are limited amount of dye colors in minecraft and jeb__ named sheep can only render RGB rainbow colours on the client
while true loop O.o
you cant block the main thread and also its not good to make stuff like that for every sheep
on entityspawnevent you can set the name to jeb__; if this is not working you might test a bit
listen for the PlayerInteractEvent and check if the action == Action.RIGHT_CLICK_BLOCK or RIGHT_CLICK_AIR
then check the player's held item (which may be null)
Thats my question how do i check that?
do you know how to work with events?
ye
then you know how to listen for the PlayerInteractEvent right?
and what if I check the position of a new sheep that spawned, then kill the sheep place a dispenser with an sheep egg named jeb_ then place a redstone block next to it and then delete the two blocks
would you be able to see the two blocks?
I have never used that but il try
@EventHandler
public void onInteract(PlayerInteractEvent event) {
if (event.getAction() == Action.RIGHT_CLICK_BLOCK || event.getAction() == Action.RIGHT_CLICK_AIR) {
ItemStack heldItem = event.getPlayer().getInventory().getItemInMainHand();
// do your checks here
}
}```
basically it
are you dutch?
yea
Hey!
Is there literally any way to check if a player opened his own inventory?
InventoryOpenEvent doesn't fire if a player opens his own inventory...
you?
What u need it for?
yeah, the PlayerInventory is in principle always open, or well, it does not possess the notion of open/closed state
im too
I want to make an ItemStack unlimited.
So... If the player drops it, it should copy it and put it back in the cursor.
It works fine as long as the player doesn't drop items while viewing his inventory
Funny thing is... The InventoryCloseEvent does fire on closing it 😅
formally is with two l's lol
Well, I want to put it back into the player's cursor if he picked it up.
But I just found a way...
I can just use the InventoryClickEvent \o/
does ArmorEquipEvent. not exist anyone or something...?
Not sure if destroy block event can get when seed its dropped but you can try this
I just want to paste terrain with block.setType();
And these seeds are getting dropped.
ah
ye will Idk
My customRecipe don't work.
this is my code, what is wrong?
public class CustomTools {
public ItemStack createLifeStealSword() {
ItemStack item = new ItemStack(Material.DIAMOND_SWORD);
ItemMeta meta = item.getItemMeta();
meta.setCustomModelData(1111);
meta.setDisplayName(ChatColor.GOLD + "Life steal sword");
item.setItemMeta(meta);
return item;
}
public ShapedRecipe recipeLifeStealSword() {
ItemStack item = createLifeStealSword();
ShapedRecipe recipe = new ShapedRecipe(NamespacedKey.minecraft("lifeStealSword"), item);
recipe.shape("DSD"
,"DND"
,"DPD");
recipe.setIngredient('D', Material.DIAMOND);
recipe.setIngredient('S', Material.NETHER_STAR);
recipe.setIngredient('N', Material.NETHERITE_SWORD);
recipe.setIngredient('P', Material.SPECTRAL_ARROW);
return recipe;
}
}
Main class Method i use:
Bukkit.getServer().addRecipe(customTools.recipeLifeStealSword());
I think the client might just not send a packet upon opening the inv possible?
?paste the code, thx 🙂
whats the error
it's just don't read that recipe exist
are you adding the recipe onEnable?
yes
are there any errors on start up
no
show me ur onenable por favor
i used this method in onEnable
Bukkit.getServer().addRecipe(customTools.recipeLifeStealSword());
Hey quick question about yaml.
Uhm I wanted to use curly braces as a place where you can put an variable in. But as I saw curly braces do a parser error. So what do I use instead when using yaml or how can I make the curly braces pass the parser?
My example: ```yaml
message-format: You recieved a message from {sender}
message-format: "You recieved a message from {sender}"
message-format: 'You recieved a message from {sender}'
Ah okay, thank you
really didn't thought about just making a string out of it, I'm stupid xd
Yeah its interesting because JSON is a subset of YAML, and since {} in JSON denotes a mapping value , it will even be valid in YAML hence why you get a format issue there.
lol ye
thanks for the quick answer
whats the best way to translate milliseconds into a readable date and time?
do i need to manually replace the &a with the §a ?
u can use ChatColor.translateAlternateColorCode or whatever its called
^^ with params ('&', the text you want to colorize)
k
Can anyone help me? I never used JSON
String str = "{ \"name\": \"Alice\", \"age\": 20 }";
JSONObject obj = new JSONObject(str);
String n = obj.getString("name");
int a = obj.getInt("age");
System.out.println(n + " " + a); // prints "Alice 20"
getInt, getString and JSONObject(str) is underlined
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!
what does it say when you hover over it with your mouse?
cannot resolve method
and required type map
do u have json added as a dependency
Question. How I'm able to check if a block is in the range of 50 blocks from a location?
which JSONObject class are you using?
looks like they're using the org.json:json one
i never know which one to use lol
you can use a DateFormatter perhaps
or if its called SimpleDateFormat idr
there is sth else also
m perhaps
i think its instant.fromepochmilli
ye
and then grab whatever date instance whether its offset or zoned
i have a long which stores the epoch time when the player joined for the first time available
LocalDateTime.from(Instant.ofEpochMilli(long milliseconds), ZoneId.systemDefault().getRules().getOffset(Instant.now()));
i think
is it possible to create an event within an event
bro i was getting yelled at the other day for switching Date objects in a small side project to LocalDateTime
💀
Question. How I'm able to check if a Player is in the range of 50 blocks from a location?
yeah
lemme just not worry about that lol
i think its player.getLocation().distance(location obj) <= 50
well arent they for different things
Thanks
idk i switched it to localdatetime to for ban objects and punishment objects to store localdatetime instead of date
good old Date
ye
its prolly more recommended to use idk
just create a new event of the type you want and call it with Bukkit.getPluginManager().callEvent(your newly created event) :)
wouldnt do anything if you dont listen for it tho
amazing ty
yeah taahanis it is
actually nvm what I said
its just immensely hard navigating all the time related utility classes since they're so spread out
Do you guys have better idea of serializing minecraft blocks?
public static String[] getStructure(Block block, Block block2) {
long time = System.currentTimeMillis();
int minX = Math.min(block.getX(), block2.getX());
int minZ = Math.min(block.getZ(), block2.getZ());
int minY = Math.min(block.getY(), block2.getY());
int maxX = Math.max(block.getX(), block2.getX());
int maxZ = Math.max(block.getZ(), block2.getZ());
int maxY = Math.max(block.getY(), block2.getY());
List<String> blocks = new ArrayList<>();
for (int x = minX; x <= maxX; x++) {
for (int y = minY; y <= maxY; ++y) {
for (int z = minZ; z <= maxZ; z++) {
Block b = block.getWorld().getBlockAt(x, y, z);
if (VirtualRealty.legacyVersion) {
blocks.add(x - minX + ";" + (y - minY) + ";" + (z - minZ) + ";" + b.getType().getId() + ";" + b.getData());
} else {
blocks.add(x - minX + ";" + (y - minY) + ";" + (z - minZ) + ";" + b.getBlockData().getAsString().substring(10));
}
}
}
}
VirtualRealty.debug("Got and serialized blocks in: " + (System.currentTimeMillis() - time) + " ms");
return blocks.toArray(new String[0]);
}
we got the bible ladies and gentlemen
yuh
even static holy shit
Ik
so by all means, static isn't probably abused here
VirtualRealty.debug("Got and serialized blocks in: " + (System.currentTimeMillis() - time) + " ms");
just me being blind as usual
what's wrong with that?
?
is it crucial to store information for every block within the two given blocks
because, a lot of stuff can go wrong on the way
What do you mean?
the data you serialize will be hard to keep up-to-date concerning that the data of the blocks in the server instance itself can change at any given time
thus usually, when storing data, we only store absolute key and necessary data
hence why for example worldguard stores the minimum point, and maximum point of a region merely
oh in that case probably fine
tho if you can
avoid the string there, create some sort of pojo representing given data, then serialize and deserialize that directly into a file or whatever other database you may have
How do I do that?
Create an object with necessary data and serialize object?
I mean list of objects, right?
cant u just serialize the block into bytes and just unserialize it
create a class with fields you want to store
hi
sometimes my brain goes brr
is it possible to detect "L" key press ?
if i want no join message do i just set join msg to ""
set it to null in the PlayerJoinEvent iirc
minecraft isnt sending key press event or something
but i saw thing which detect it
i know it sending "f" key event
??
no sadly the client does not send every key pressed to the server
one question
hijack the client or something
so pretty sure L won't work unless you give the user a special client
which keys server detects
really none
i know
but it detects for stuff like F
F
but thats just due to you having your keybind set to F
yes
the client tells the servers about actions rather than individual key-press actions
It’ll detect the input, but not the key. You can change your keybinds.
one person is telling me he can detect any keys (without any specific client)
is it possible?
that's full on mega cap
I mean, probably/
at least from server point of view
If you never change your keybinds, then it’s pretty easy to assume what keys are pressed. But you can’t get anything past that.
is it possible on custom spigot jar or something?
lemme check if he is liar or not
how could i return multiple things from a event not just one
elaborate
generally methods either return void (nothing), or a single object which must conform to the given type the method promises to return
isnt he talking about using the right constructor?
no clue lol
so i am trying to get items to drop when an entity is killed from a custom arrow. however i cannot get what happened to the arrow from EntityShootBowEvent i have to use ProjectileHitEvent. but all of my checks can only be done in EntityShootBowEvent
you could mark the arrow (using sth like pdc or metadata values) in ESBE and then in PHE ensure the projectile is correctly marked, then continue logic there x)
Can I serialize list of objects?
it is still sending the custom message
atom theme
debug your logic inside those if statements
Guide to dependency injection: https://www.spigotmc.org/wiki/using-dependency-injection/
:}
you're the first one i see using static event methods lol
doesnt matter in fact but yea :)
does anyone know what bukkit configuration api returns from YAML? primitive arrays or lists impl?
will this give some new options to spigot api?
whats the best way to have a timer for a combat log
what are the tags
aren't we have already namespaces for registries
you already can create your own tags O.o
for example ?
the api currently just catches the mojang tags
you can add items for example to mineable/pickaxe tag
which will make blocks mineable with a pickaxe like in vanilla
or in animals_spawnable_on tag
if you add for example stone
animals would spawn on stone too, not only on the grass blocks themselves
probs decompilation errors?
dont know ... is there an online source code for craftserver ?
its a string ...
Conclure after serialization it weights more then previously.
wym
why is it even creating a new offlineplayer when hes not found on the server? that would mean you're working with offlineplayer which dont exist
hey im tryna make a config file for my plugin, but im not sure how to. I want it to look something like this:
goldenheads:
item-name: "&bHello"
item-lore:
- "first line"
- "second line"
- "third line"
effects:
- ABSORPTION:3:120
- REGENERATION:3:8
But i dont know how to let my program detect a new line and add it to the lore, and also how to use the syntax in the effects section (<effectname>:<effectamplifier>:<duration(s)>)
List<String> loreList = config.getStringList("goldenheads.item-lore")
that gets the lore
String#replace is something, like %player% as a placeholder
Use the & and when you get it as a string replace it with the $ (not dollar, i dont bave the right simbolo )
i can use them in the code, so should i just use my own method ?
like
p.sendMessage(ColorUtil.translateColors("&c " + config.getString("goldenheads.cooldown-msg")))
public class ColorUtil {
static public final String WITH_DELIMITER = "((?<=%1$s)|(?=%1$s))";
/**
* @param text The string of text to apply color/effects to
* @return Returns a string of text with color/effects applied
*/
public static String translateColorCodes(String text){
String[] texts = text.split(String.format(WITH_DELIMITER, "&"));
StringBuilder finalText = new StringBuilder();
for (int i = 0; i < texts.length; i++){
if (texts[i].equalsIgnoreCase("&")){
//get the next string
i++;
finalText.append(ChatColor.translateAlternateColorCodes('&', "&" + texts[i]));
}else{
finalText.append(texts[i]);
}
}
return finalText.toString();
}
}
thats just the util i use
alright thanks for the help i will try it out :)
Trying to make an ItemStack with GRILLEDPORK, but it cannot resolve symbol ...
features for what
maybe its ur version hasa diff ID
whats wrong with ChatColor.translateAlternateColors('&', your text)?
For my plugin
why all those things
no clue but i made that util ages ago, so i cba to change it now
it works so eh
it used to have RGB support, which is why i kept it
but this plugin is for 1.12 and below
Thats the compiled code when you have a switch-case over a string.
switch("test"){
case "test": //code
}
gets compiled to
switch("test".hashCode()){
case /*hashcode of "test"*/: //code
}
so i just removed the rgb part
it will loop though the string and change every valid color code to a chatcolor
I can make ItemStack of stone_sword and leather_chestplate but not Grilled_pork
what version
Are you sure thats the right name for thst item?
try normal pork
1.18.1
Name Resource location Numeric ID
Cooked Porkchop cooked_porkchop 320\
how do i check if a projectile killed a entity
cooked_porkchop
? the problem i see is that there is a hashcode for the string to switch state (WHICH means you identify the string already) and then there is a if check in the switch again ...
Please guys i need ideas 😣😣😣😣
Hmm, didn't say that in the tutorial, wierd
😶
that may be for a different mc version
the tut you are watching
Still not solved
EntityDeathEvent
vanish command
Already done
wanna see
?
mine
Sure
Nice
from 1.8-1.18 its minecraft:cooked_porkchop idk where u got grilled pork from
i didnt. check all the versions in between but im fairly sure they didnt change that
ups wrong person
when im bored i take a look at the essentials commands
Uhm nice idea
Ah I see. Probably to avoid/fix a hash-collision because two different strings can have the same hashcode
yeah but why does it have the switch then ? i dont know if its just decompile or just coded like that
Don’t worry
Guys is it possible to change the player name on the player character?
Well I dont know why but probably because they used a switch.
Its ok To use NMS or anything
I just want to know if it’s possible
No no the name of the player
Yeah
And that will change the name?
Like Nametagedit changes also the name above the head of the player, will this change that?
Uh is it possible to use a plugin as a library? without the plugin itself making one?
I mean if there are any dangers or conventions about it
for example
I have plugin A, i wanna use its methods in plugin B
can I just make a fat jar or smth
and use it
ye
but is there any danger
doing that
or just a dependency?
its a plugin
Ty
alr so u dont shade it?
What are you trying to do with that plugin
A plugin that gathers all the materials you mine and change them into Money which you can use to buy pickaxes that when placed mine for you , like minions but with the pickaxe going around a specific point an mining it
https://paste.md-5.net/udonuhowax.cs
https://paste.md-5.net/asodidubun.java
https://paste.md-5.net/koqitefota.java
Do you guys know why it happens?
like a /sell command
Honestly, people forget that symbols in YAML like |, |-, |+, > exist
there's no need to make lists if you're parsing a string with new lines in it
Mining XP System where u can lvl up etc..
Is this typo in javadocs? Because 1.18 is the Y value bigger.
Get block data for block at corresponding coordinate in the chunk
Params:
x – 0-15
y – 0-255
z – 0-15
probs
not updated i guess
its not a typo, its just not updated
Increase your mining speed or double/triple loot
Nah
Dunno
Ur choice
its just an idea ^^
yeah have not test yet outside the range , but I think is pretty hilarious it have not be updated 🙂
do you use '[]' or '<>' for optional arguments, or is there no standard?
There is no standard
oh well
generally tho how I see it is <> is for required, [] for optional
http://docopt.org/
Thats what i found. The same format goes on brigadier
purely random and has probably been asked 650 times
is a prefix like this doable outside of custom resource packs
am v unfamiliar with most 1.17 features
No
thought so, thank u kind sir
is there anywhere here for hiring paid developers?
?services
If you wish to request or offer development/art/building/administration services, please do so at https://www.spigotmc.org/forums/services-recruitment-v2.54/
need 20 posts :/
resource packs w unicodes iirc
yea
Like , how did they change the player display name above the head here @quaint mantle
Chunk chunk = p.getChunk();
createChunkFile(chunk, true);
for (int y = -64; y < 320; y++) {
Bukkit.broadcastMessage("current y level: " + y);
writeAndReset();
for (int x = 0; x < 16; x++) {
for (int z = 0; z < 16; z++) {
Block block = chunk.getBlock(x, y, z);
writePalette(block);
writeMap(block);
}
}
}
}
public void writeAndReset() throws IOException {
if (!blockCount.isEmpty()) {
for (Block block : blockCount.keySet()) {
//Bukkit.broadcastMessage("Block at: X" + block.getX() + ", Y" + block.getY() + ", Z" + block.getZ() + " | " + block.getType() + "(" + blockCount.get(block) + " )");
int index = chunkFile.getStringList("palette").indexOf(block.getType().toString());
char c = PALETTE_CHARS[index];
buffer += String.valueOf(c) + blockCount.get(block) + "/";
chunkFile.set("blocks", buffer);
Bukkit.broadcastMessage(block.getType() + " | " + blockCount.get(block));
}
chunkFile.save(file);
blockCount.clear();
}
}
public void writeMap(Block block) {
blockCount.put(block, blockCount.getOrDefault(block, 0) + 1);
}```
Hey, I have a couple of issues - I'm wanting map `blockCount` to clear every time `y` increments and I'm wanting the count to increment, but its always 1. What am I doing wrong?
what does writePalette do
It's irrelevant in this case, that method works as expected.
^
my bad
also u can just use like .entrySet or .forEach on blockCount to get both key and value
instead of iterating through keys and then calling .get later in the loop
Guys to make an entityplayer make every action another mob does ( i wanted to add AI to an NPC) what should I do?
What is the equivalent to Action.RIGHT_CLICK_BLOCK?
I can do that, but it's not really necessary right now - the main issue is the map blockCount does not increment past 1
well how could it when ur always clearing it
It should only be clearing when the y loop increments
maybe its bc its on a per-block basis
idk if im understanding this correctly but say u had an entire Y layer of dirt
ur expecting blockCount for that block to be 256 yeah?
correct
but it wont be
because each block is different
they have their own data even though theyre the same type
possibly? idk tbh
sounds like a temporary fix that could lead to problems later on when u have similar blocks at different states (ex, crops) but idk
I plan to append states to the end of their material in the palette, such as LEAVES[distance=whatever]
So when I use a breakpoint, it shows both players in the list, but when I loop through it shows CraftPlayer?
Collection<Player> playerList = new ArrayList<Player>();
for (Player player : Bukkit.getOnlinePlayers()) {
if (player.getGameMode() != GameMode.SPECTATOR) {
playerList.add(player);
}
}
my player list
So the list shows both players in IDE- but when it runs the code in game it just misses the second player
the toString() in CraftPlayer just returns its Class and the Player Name
dont know about IDE stuff simulation ^^ @ivory sleet
You need to extract what variable from the Player object you want. Just doing player will return the object itself
Ta
Turns out it's because I was removing the player from the list so the for loop sorta broke
they use invisible floating entities
Can I conect me to my Minecraft java server using the plugin geyser by a Nintendo switch??
Hello?
- wrong channel
- probably, if you set Geyser up correctly
tho i think geyser requires you run it on a pc
Ok thanks and sorry
How to get CraftWorld in 1.18.1?
Cast world to craftworld
