#help-development
1 messages ยท Page 2161 of 1
that's actually how I started doing plugins
ClickSort was broken in 1.13 so I made ChestSort lol
so yeah I am glad about 1.13
i started with the 1.8 api
Same
than I was like this is so shit so I started using the 1.12 api then I was like fuck this I'm going to 1.16.5 screw everyone I'm not giving you guys support
well my first plugin was in 1.4 but it was so bad, I never uploaded anything to the public back then
I sold my first plugin for 20 dollars
yeah that's the proper way
1.2.5 good old days
people who still use 1.8 or 1.12 should also not expect new plugins to be released imho
after all noone does games for windows xp today
ignores me the greatest new windows xp developer
fr
fr?
fr
fr
I was so young i don't even remember what version I started playing mc on
I started playing when I was 5 lmao
Oh sorry my oddy dutch
You can be my granpda lmao
i thought he was german
I'm the greatest US citizen
my people skills are really bad
1.2.5 was king. we didnt even had chat in single player sheesh
hat the heck dutch isnt "dama"?
there is no way this kid isnt drunk
your english is weird sometimes lol
I was smooking a bit of wheel
yea thatll be the greatest solution
and them you can find someone to fixthe toilet, because you will make it explode
Supposedly the spicy makes you shit a lot
depends on the person I guess
I finally made readable ItemStack to Config and Config to ItemStack translation 
I never had any toilets explode after eating spicy food
nice
the code is horrible but ahahha I did it 
Luxembourg? no that's its own country
Now see if it retains enchantments
oh but it does
it also retains item flags
nice
yeah, out its another country? I always thought its was on germany because sound a deutastch word
I could make it retain PDC but I don't really need too
nope it's a very small country and they mainly speak german but as said it's its own country
oh weird
and everything is extremely expensive there
I once was in their capital, I think it's called Vaduz and I had to pay 18โฌ for a menu at mcdonalds
in germany it would have been like 8โฌ
I dont know why smooking weird or wheel relax me
I need to split this class still, but https://github.com/Y2Kwastaken/ArcticLib/blob/master/arcticlib/src/main/java/sh/miles/arcticlib/items/ArcticStack.java
it's called weed lol
not weird or wheel lol
Yeah that i couldnt remember the name
lmfao
Too much for now
noone
I will keep it fornext month
15y what more i can do ! I dont even allow to run a motorbike
I "only" do plugins
that's my job
I once had a counter strike server lol
back in the days when people played counter strike source
What a good momments i rember seen it
Oh stormy days are perfect for taking a snap
yeah taking a snap, smoking a wheel, lol verano you should really go to sleep lol
lmfao i dont know why im saying idiots things
You need a nap sheesh
I don't mind lol
I wonder if that objList part could fail if the list from the config is a list of something other than String
oh lol, you have braked my gurt :break_geart:
it does, but it won't do to lore needing to be a string
if you can get the lore to be an intenger it would break the code
I mean what happens if I put a list of numbers into a configuration and call section.get() on it
does it return a List<String> or a List<Integer>?
List<String> lore = YamlConfiguration#getStringList("Items.path.lore");
List<Object>
generics are removed on compile time anyway
the JVM will always only see a List<Object>
even for getStringList etc
yeah true, but I'm just saying what if the setLore method calls string methods on the objects it assumes to be String wouldn't that throw an error
it'd return List<Object>
is what I'm saying
yes Theone
the compile time check should hinder an instance of List<Object> from being passed tho
List<String> myStringList = getConfig().getStringList("my-list");
String firstString = myStringList.get(0);
this basically compiles to this:
List<Object> myStringList = getConfig().getStringList("my-list");
String firstString = (String) myStringList.get(0);
if (objLore != null) {
if (!(objLore instanceof List)) {
ArcticLib.LOGGER.log(Level.WARNING, "Your Lore Must Be A String List");
return arcticStack;
}
arcticStack.setLore((List<String>) objLore);
}
I was talking about this bit in Y2K's code.
exactly
I'm blindly casting
which could return in error but in the circumstance it would your formatting is already incorrect
i'll continue learning this song on keyboard, brb lol
I haven't looked through your code that much so I'm not sure if there is but is there a reason you're not just utilizing the getString, getStringList, etc methods from configuration?
and instead opting for doing the type checks yourself?
yea there is I'm handling errors myself so they are more readable for idiotic people I've yet to add something for the lore list though
as its still a WIP
I can't expect server owners to beable to read java errors
Basically trying to prevent people from doing stupid formatting and then coming to me like askdjfhlaksjdhflaj wTF bro it don't work and paste an error only for me to figure out they typed something wrong
alright makes sense.
Why can I not use player.openInventory(); to open an inventory to a player ?
you can do that just fine
For some reason, it doesn't want to.
what kinda inventory are you trying to open? and when?
when rightclicking what? obviously if an inventory is opened "by the event itself" then you either have to cancel the event or open your inventory one tick later
Action.RIGHT_CLICK_AIR and BLOCK
I have no clue what that means
is your event listener code actually running? try to add some message like Bukkit.broadcastMessage to see if it actually runs
displayname of what?
the Item that i'm holding
so that's the problem, and not the openInventory(...) part
yes.
how are you checking the item's display name? and keep in mind that players can rename items on an anvil themselves
Just added some "sout" and figured itout
normally you rather should use custom PDC tags to identify your custom items instead of doing it by name
ooh
I modify my items with PDC
so does it somehow edit it
if(p.getInventory().getItemInMainHand().getItemMeta().getDisplayName() == "Harvester Hoe")
this is how i check
public static String hoeName = colored("&aHarvester Hoe");
Oh yeah two things I have to mention:
And this is how i save it
First of all You should always use equals() to compare Strings, and NOT ==
OMG
and second, your custon name has a color code in it
so it'll never be equal to "Harvester Hoe" anyway
and third, as said, keep in mind that people could simply rename items on an anvil to have this name anyway
Would it trigger if the color is not green /
use ChatColor.stripColor to strip the color
You should instead add a custom PDC tag to your item and then check if that item has this tag
that's probably the only proper way to identify your custom item
i was thinking about making a customitems plugin but some things came in between lol
NBT != PDC tag?
@sterile token do you have your code btw
pdc is basically a wrapper around nbt stuff
its persistent
no
I'd do it like this
public static void markAsMyCustomItem(ItemStack item) {
ItemMeta meta = item.getItemMeta();
meta.getPersistentDataContainer().set(new NamespacedKey("my-custom-item"), PersistentDataType.BYTE, (byte) 1);
item.setItemMeta(meta);
}
public static boolean isMyCustomItem(ItemStack item) {
return item.getItemMeta().getPersistentDataContainer().has(new NamespacedKey("my-custom-item"),PersistentDataType.BYTE);
}
oh yeah i rememember some say it was saved on world file or something like that
the PDC internally gets stored as an NBT tag called "BukkitValues" or "PublicBukkitValues"
no problem lol
this channel is made for questions about spigot lol
so yeah one could kinda say "PDC is a wrapper for NBT but you can only use it to access data that was also added using the PDC methods"
or using nms aaa
yeah but only if they were added to the "PublicBukkitValues" NMS compound tag
yes
and if someone would use that, there's no need to use NMS in the first place
they could just directly use the PDC methods
So with pdc i can assign custom data to a itemstack and then compare it but getting it with event.getBlock ?
hm no not really
you can assign data to itemstacks but once the item is placed, all this PDC data is lost
So how you can do a placed block unique for others?
Weird so
only tilestates, entities and chunks have a pdc
yeah that's why I wrote my "CustomBlockData" library
Oh ok
and worlds and ItemMeta ofc :3
I will take a look
ah mye
although for worlds it was only added recently
and some blocks 'host' a tilestate, like a chest, barrel etc
Its strange because you can add meta to item stacks, but not for blocks, too much weird
chunk has PDC since 1.16.3, itemmeta, entities and tileentities have it since 1.14.1 and I think World was added in 1.18.1 but not sure about the last part
I guess it has something to do with how blocks are stored in the vanilla server "save file format"
itemstacks basically always supported NBT but blocks never did
Oh allright, but ts not cause of client-side right?
Yeah only tile entities have every supported it.
no it has nothing to do with client/server
why do my fingers smell like cake wtf
beacons are tile entities 
yeah it's weird. some blocks can store any data while others cannot do this at all lol
I dont event know what the dfinition of an entity
as said, I was so annoyed by this that I made a library for this which "abuses" the chunk pdc to give you a PDC for every block. It should really be builtin though
Indeed, however it'd require a lot more data to be stored for each block
yeah of course but after all you can also simply add "too much data" to a player to break spigot anyway
so I guess that can't be a reason to not add it
+1
I mean if each block had the ability to store data. It's not something moyang needs
then you might aswell add a lot of data to a chunk to break it
IE they have no reason to store anything in a dirt block so they don't need that functionality
I once tried to check how much data a PDC can handle. I added about 1 MB of data to EVERY loaded block. the server took like half an hour to shutdown properly but it still worked
so yeah it's definitely not good to store huge amounts of data
Is there a way to get a list of every single block in the game
Yup
How :O
not directly. you'd have to read the region files yourself and then check what chunks were generated
or manually load those chunks
both are shitty methods
so I'd say there is no proper method
in that game? i don't understand what you mean
Like I want every block that minecraft has made in an ItemStack array
ah
I don't get it
declaration: package: org.bukkit, enum: Material
loop over Material.values() and check if Material#isBlock
i want all of it
There have all of it
oh thanks FourteenBrush
no checking then
oooh that's what you mean
So its not possible to keep track of unique blocks hmn
so you are talking about materials ant not blocks
yea yea
Like i yes or yes need to keep track of a unique block, because i need to hide / unhide a protection block
๐
yeah as fourteen said, check material.values() and then check if that material is a block there's an isBlock() method)
e.g. a diamond_hoe obviously is not "a block"
Load every block in the world and detect if it exists in your hashset

Get all 3 dimensions
very optimized
Wouldn't take too long. Save it to a txt file with /n separator for efficiency
save te json in a database
My pl only allows world protection
they don'T allow crack cocaine?!
This messages is even more random that mines
yes, my messages mine diamonds. yours only mine coal
okay?
Move to Columbia. I hear it's safe there. Free cocaine
what exactly?
Im not trolling
I need to hide unhide a custom block
So i need to set a custom data or unique identifier to each protection block
So then if a protection is a block coal, it doesnt hide every coal block
Do i explaine?
as said, you can use my lib to get a PDC for every block. otherwise you have to use some workarounds
Atm we dont use pdc for multiversion support, that our main issue
oh god
then you have to use some weird thing like a json file or sth
yeah for real we should add a new rule here like "1.8 = no help" lol
Nop, 1.12.2
Forge does that
even better
1.16.5 and 1.18.2 only
whats wrong with the 1.12 graphics
I think every version for coding its okay, becuase as people said, for preferences you have colors
but in 1.8 you only have 16 colors
in 1.16 you have 16 million colors
ok but 1.12 the same thing applies
not even the sun is that far away
please be serious :(
I am serious. 1.12 sucks and everyone who still uses it is weird imho lol
was great for modding
1.12 doesnt have pdc iirc
as said, PDC was added in 1.14.1
and on chunks it was added in 1.16.3
and for worlds in 1.18.1 although not sure about this part
Why yes or yes pdc?
yeah, whats interesting though is that some servers (hypixel as example) create their own tile(states?) somehow and are able to use them on their custom blocks, which seems to be more consistent than making a system to save/load block data
not sure how they did it though, ive been curious for a while
Yeah but hypixel is probably an incredibly heavily modified server written by 6 figure java senior devs
PDC are not the only way, you have NBT for setting custom data into items
I bet they simply use some sql db to store blockdata
Oh i have find something more im tracking each protection location
So maybe i can only hide the block on that location
NBT is not API though
and save it again when the chunk gets unloaded
SQL == ๐คฎ i hate sql
they use slime which can store to sql yeah, but ik that they create a custom tile entity to save the block because of how many dupes me and some other have found testing with custom blocks
not until PDC was added.
gn
Lovely headachers with joining tables, and that shities
why doesnt school let me sleep an hour longer, its like study the first hour
SQL is faster than other langs so it's hard to not use it. Plus it's really mainstream
When you are on high-school its doesnt matte
not yet...
as an example: if you place a tile entity in the same block as one of their custom ones, it will completely bug it and put it in kind of a ghost state out and cause a lot of other issues
yeah I learnt SQL like 15 years ago. and have already forgotton almost everything lol
plus a ton of dupes/weird things with island freezing involving tile entities that they forgot existed and didnt think to fix manually
that doesn't have anything to do with SQL though. If something gets duplicated, that's definitely not the fault of the database system that was used
yeah, didnt say it was
true, just wanted to mention it ๐
im saying that they use slimeworldmanager to store the worlds, which can also save worlds directly to sql
(slime is very cool btw)
worldedit's API is overly complicated imho
Yeah
I think doing your own cuboid its even more simple than using their api
๐
well spigot has cuboids builtin
called erm
how are they called again
BoundingBox
Yeah, but its doesnt things like rotate over Y/X/Z
yeah it actually has nothing to do with blocks
it simply represents a "region" in an XYZ world
Yeah, does it keep at Location 1 and 2 right?
yes
And them it calculate
I thought they were more diff
I finally did a cuboid and worked
But i have some issues hahah, that the protection block can be breaked by everyone, but the claim is not deleted
So im raging
And that why i smoked wheel
I get too much stressed and ancious
i'd probably /kill myself if I had to use 1.12 api ever again
I couldn't live without PDC today
Can someone help?
did you add the repository for the toml dependency?
Win10 edition is C++. Windows version is Java
Oh ok
This was 2 hours ago. I'd say I am patient
I used to wait more than 20 hrs
๐
Well even then, I'm not saying it's urgent I was just bumping
I just saw that the toml4j is on maven central. did you click on the maven reload button in your IDE?
I'm not even sure how that works. I edited my pom.xml and that's it
are you using intellij?
Yea I did
Yes
hm well if you already clicked on that than all I can recommend is to click on the "m" button in the maven window and then enter mvn clean package -U
The package exists just fine
Well is there any other steps I was supposed to do than add what I added to my pom.xml?
no, more isn't needed. you added the dependency and it's on maven central, so it should work fine
click on this button and enter mvn clean package -U
then wait a few seconds and it should work fine hopefully lol
and if it worked let me know pls because then I can stop googling
hm weird. sorry no idea, I gotta go to sleep now. try to run mvn with the -X switch and see if the log contains some more information
did you add any dependencies manually?
toml4j is the only dependency I have
Alright well thanks
You could invalidate caches and restart
yeah but that wouldn't explain why maven itself throws an error
invalidating caches basically only helps when intellij is weird
maven has a timeout after it fails to find a resource
yeah that's why I asked them to run mvn clean package -U
and if it cannot find a dependency, the error would look different
if maven can;t find the resource he should have all kinds of errors in his IDE
it seems like it does indeed find the correct dependency but the package name is just not correct
otherwise maven would be complaining before it would even run javac
so yeah I have no ideas left lol
would be interesting to see hsi full maven log
I only saw a partial
ah ok
I see no attempt to download, is he in local repo only or seomthing?
offline mode
hm the log says "downloading from ..." for paper-api so probbaly tehy are not in offline mode
no attempt to download the other dep though
and the toml dependency they wanna use is on maven central
yeah I guess they simply use the wrong pom xml file or sth, I really have no idea
maybe they have two pom files or sth and are trying to use the wrong one or sth
could be
I really gotta go to sleep lol. have a good night everyone :3
night
im teleporting two players into a new world and for some odd reason my one account and see the other player and the new one cannot see the old one
anyone have a clue on why this is happening?
Hey so can someone help me out. Im trying to use toml4j on a project and it seemed to give me errors when trying to compile so I tried it out on a seperate test project and its giving me the same error
Error:
package com.moandjiezana.toml does not exist
The test project:
https://github.com/Christian-Madlansacay/toml-test
either you showed us the wrong pom earlier, or I'm going to guess you clicked the offline button in InteliJ
You log shows no attempt to download that dependency
Right but the dependency is working so I'm confused. I feel like if it wasn't working then it wouldn't let me auto import stuff and I think there would be errors but yea
do you have multiple poms?
Not sure exactly what that means but do I need to change something?
ok, I got it to build. Changed the scope of the toml resource to compile
Maven has no shade scope
been looking at model engine and went on the demo server
found out that not only do they have custom models but some of the UIs are straight up actual custom. as in the rules page has a whole thing and https://i.kawaii.sh/U1Fn~VZ.png
This?
How tf did they do that with just resource packs? is there a guide lmao
the custom uis are custom models
formatted to create a shell in the inventory
underneath it's just a normal chest ui
how does it spawn a custom model over the inventory ui?
if I do Material.values() in the 1.8.8 API, will it return 1.18 blocks? I have some items not showing up. They aren't null. They aren't air.
This is showing on the 1.8.8 client, (Im using a 1.18 texture pack)
Usually titles or items
https://www.spigotmc.org/threads/custom-inventory-ui.525744/ i made a post on how to do this a while back its a bit outdated but you can get an idea
Hey so how would I go about using a variable in another java class?
make it public
Yea but what do I do if its inside my onEnable method?
Yes
Create the variable before the onEnable, define it in onEnable, and then you can access it anywhere
I just did this and it says it cannot resolve symbol in my other class
show your code
I have this outside
public Toml config;
Then I have this inside of my onEnable method:
config = loadConfig("config");
I tried this inside of another class
config.getString("test.get");
It says
Cannot resolve symbol 'config'
because you arent referencing the class
java wont know what config you are talking about
do you have an instance of the main class
Oh I just put my main class.config then it worked
yep
is there a way I could hire someone to make a plugin for me? If this isn't the place to ask, where should I ask?
?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/
Is there any reason you are using toml over teh built in config?
UUID.fromString("74c5424e-1e12-4c89-978a-cff4d6750ca6")
it java.lang.IllegalArgumentException: UUID string too large
how can i solve this?
use a valid string
I get this uuid from player..getUniqueId().toString()
then thats not what you are passing to fromString
are you storing the string before you attempt to reassemble it?
I stored it yet , and before I parse the UUID string to UUID , printed it to console , it shows "74c5424e-1e12-4c89-978a-cff4d6750ca6"
?paste show some code
System.out.println(ep.get(i).toString());
Player it = Bukkit.getPlayer(UUID.fromString(ep.get(i).toString()));```
what is ep?
enabled_player , it is a json_array
yes , i parsed it , ep.get(i).toString() is a String type now
UUID.fromString(ep.get(i).getAsString().replaceFirst(
"(\\p{XDigit}{8})(\\p{XDigit}{4})(\\p{XDigit}{4})(\\p{XDigit}{4})(\\p{XDigit}+)", "$1-$2-$3-$4-$5" ));```
you may not have to do the regex IF this is just pulled from a Player and not a quiery to Mojang
java.lang.IllegalArgumentException: UUID string too large
: ( same
remove the replaceFirst(
it is parsing this string "74c5424e-1e12-4c89-978a-cff4d6750ca6"
thanks , it works.
Is there any agorithm to spawn custom mobs
you can do that with nms but there is no special method or algorithm
The person who made thia regex
Has way too much time
lul
I'm having an issue which is simple to fix but yet I don't know how
If I were to summon a zombie I need 1000 lines of information about the zombie
How would I get this information and spawn a zombie with it?
Since I don't want a 3000 line class of pain
Does anyone know how you would do this or even if you can?
Zombie zombie = (Zombie) location.getWorld().spawnEntity(location, EntityType.ZOMBIE);
I dont understand, can you describe it?
zombie.setBaby(true) maybe
i'm wondering if you still need the cast
ah ye if you need a zombie object
Uh oh
I tried to make the zombie "float over the players head" but the loop crashed the server?
You can not sleep nor delay the main thread
^1
yeah probs
out of curiousity, what about an async call?
a repeating task is enough. No need for async
but, yes you can sleep async threads
Hi, I have items stored in a config like this:
shops:
shop1:
owner: eeced9a1-0f41-483b-870f-c826a0462d59
id: 1
items:
- !!me.notro.playershops.Utils.ShopItem
item:
==: org.bukkit.inventory.ItemStack
v: 2586
type: DIAMOND
price: 20
- !!me.notro.playershops.Utils.ShopItem
item:
==: org.bukkit.inventory.ItemStack
v: 2586
type: GOLD_INGOT
amount: 3
price: 80
Friend said that just parsing it like this
List<ShopItem> items = (List<ShopItem>) shopsConfig.getList("shops." + shop + ".items");
items.forEach(item -> s.addItem(item));
Will work, but i'm getting errors that !! is wrong
I'll send the logs soon
Uh, so? How i can get this to work?
Or I'll just create the variables manually
hmmm
okay, i'll do it
How are you serializing yoru ShopItem?
for (Shop shop : shops)
{
shopsConfig.set("shops.shop" + shop.id + ".items", shop.items);
}
saveConfig();
this?
public class StrengthZombie extends EntityZombie {
public StrengthZombie(Location location){
super(EntityTypes.be,((CraftWorld)location.getWorld()).getHandle());
}```I unable to use this code and it give me error"x()' in 'net.minecraft.world.entity.EntityInsentient' clashes with 'x()' in 'net.minecraft.world.entity.EntityLiving'; attempting to use incompatible return type"
also i am unable to use the entityfeatures
Is there a way to make the zombie stay above my head?
Is it possible to set the compass direction for an individual ItemStack?
Without Y'know breaking everything
Yes, either move it in teh PlayerMoveEvent, or run a repeating BukkitTask every tick to update teh location
do you mean a Compass to point to a location?
Why does my event not get called?
Main Class:
public class FFAHardcore extends JavaPlugin {
// CLOUD-TARGETGROUP: ffahardcore
private static FFAHardcore plugin;
@Override
public void onEnable() {
plugin = this;
}
@Override
public void onDisable() {
}
public static FFAHardcore getInstance() {
return plugin;
}
private void registerEvents() {
PluginManager manager = Bukkit.getPluginManager();
manager.registerEvents(new PlayerJoinListener(), this);
}
}```
public void onPlayerJoin(PlayerJoinEvent e) {
System.out.println("debug");
Player p = e.getPlayer();
PlayerInventory inv = p.getInventory();
inv.clear();
getItems().forEach((item) -> {
if (item.getType().equals(Material.DIAMOND_HELMET)) inv.setHelmet(item);
if (item.getType().equals(Material.DIAMOND_CHESTPLATE)) inv.setChestplate(item);
if (item.getType().equals(Material.DIAMOND_LEGGINGS)) inv.setLeggings(item);
if (item.getType().equals(Material.DIAMOND_BOOTS)) inv.setBoots(item);
if (item.getType().equals(Material.DIAMOND_SWORD)) inv.setItem(0, item);
if (item.getType().equals(Material.GOLDEN_APPLE)) inv.setItem(1, item);
});
}
private List<ItemStack> getItems() {
List<ItemStack> items = new ArrayList<>();
ItemStack helmet = new ItemStack(Material.DIAMOND_HELMET);
helmet.addEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, 3);
items.add(helmet);
ItemStack chestplate = new ItemStack(Material.DIAMOND_CHESTPLATE);
chestplate.addEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, 4);
items.add(chestplate);
ItemStack leggings = new ItemStack(Material.DIAMOND_LEGGINGS);
leggings.addEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, 3);
items.add(leggings);
ItemStack boots = new ItemStack(Material.DIAMOND_BOOTS);
boots.addEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, 3);
items.add(boots);
ItemStack sword = new ItemStack(Material.DIAMOND_SWORD);
sword.addEnchantment(Enchantment.DAMAGE_ALL, 1);
ItemMeta swordMeta = sword.getItemMeta();
swordMeta.spigot().setUnbreakable(true);
sword.setItemMeta(swordMeta);
items.add(sword);
ItemStack apples = new ItemStack(Material.GOLDEN_APPLE, 10);
items.add(apples);
return items;
}
}```
Event Class
it prints nothing
Yes I am looking for a way to set the compass target for an individual ItemStack instead of a player
Is it annotated @fresh templethandler ?
aww shit
unlucky name there XD
Yes you can, but you have to update it whenever it is put into or take out of an inventory
Poor dude who is tagged
Set tracked to false else it will not work properly
how can I make sure config comments are not deleted when setting config values?
This is what I am looking for but I need it to work in 1.12.2
.config.options().copyDefaults().save
thanks
?paste
https://paste.md-5.net/edepabewel.cs
still does not work :/
https://paste.md-5.net/sopogafuzo.java
this is my whole main class
and this my event class
No reason you should not see the debug message
it does not get printed ๐คท
save() method doesnt exist
it will be saveConfig or something close
just use auto-complete lol
You didn;t call registerEvents() in yoru onEnable
bruh
Is it possible to have 2 compasses with different targets in a players inventory in 1.12.2?
ty xd
unlikely
1.16.5 yes
I don;t believe Lodestones existed before 1.16
in 1.12.2 the compass target is set per player
How do you use bukkitTask?
?scheduling
do you actually need a BukkitTask? runnables are easier to use
he needs a runnable
Uhhhhh
its all in the wiki link
public void onEnable() {
Bukkit.getScheduler().runTaskTimer(myPlugin, () -> {
Bukkit.broadcastMessage("This message is printed every tick.");
},0,1);
}
0 is the initial delay, 1 means every other tick from then
I got that part but what is myPlugin?
the instance of your main class
if you do it in onEnable, you can just use "this"
because obviously "this" is your class that extends JavaPlugin in your onEnable method
Guide to dependency injection: https://www.spigotmc.org/wiki/using-dependency-injection/
new PlayerListener(this)
Uhhh
Where does this go?
depends if you need it
?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.
you are going to float a zombie over the player when he logs in?
Only when the command is typed
Lemme type this
in that case you need to create your runnable when you spawn the zombie
you probably want to schedule your runnable in your main class and in your command executor, simply add the player to a list / map whatever
@Override
public boolean onCommand(CommandSender commandSender, Command command, String s, String[] strings) {
if(!(commandSender instanceof Player)) {
commandSender.sendMessage("Only players can use that");
return true;
}
Player player = (Player) commandSender;
if (command.getName().equalsIgnoreCase("auracheck")) {
if (strings.length == 1) {
Player target = Bukkit.getPlayer(strings[0]);
if (target != null) {
Server server = target.getServer();
World world = target.getWorld();
Location playerLocation = target.getLocation();
Location playerAbove = target.getLocation();
playerAbove.setY(playerAbove.getY() + 5);
Zombie zombiespawn = (Zombie) world.spawnEntity(playerAbove, EntityType.ZOMBIE);
Bukkit.getScheduler().runTaskTimer(myPlugin, () -> {
Bukkit.broadcastMessage("This message is printed every tick.");
},0,1);
}
}
}
return false;
}
}
there's no need to schedule one runnable per player
true
I'd rather use one runnable for all players who have this feature enabled
update all with a single runnable
I mean it'll also work in this way but it's just not needed
OHHH
I get you now
I'm a spaz
If I put the getSchedular in the onEnable I can just use it for everything
yes that's what I meant
I hate how FileNotFoundException is not a runtime exception
I know that poison effect can't hurt you when you're at 1 hp but is there a way to bypass that?
All I could think of is a very ugly workaround
like looping over players, check if they have a poison effect, then manually apply the damage if they are at 0.5 hearts already
ok i'll just use wither
Funny question but how would I activate the zombie tp from the onEnable?
I don't understand the question
also intellij's "search for dependency" window is so useless. obviously I'm looking to add apache commons lang 3 but all it shows me is other libraries that include apache commons >.<
This is my onEnable
This is a separate class that I want to tp the zombie due to the variable being in this class
But they are to different classes?
I'd store a List<Entity> as a Field in your main class
is there an event for the anvil when i actually use it?
not the prepareanvilevent
inventory click event right?
sth like this in your main class:
public class Main extends JavaPlugin {
List<Entity> myZombies = new ArrayList<>();
public List<Entity> getZombies() {
return myZombies;
}
check if the inventory is of type anvil
then you can do myPlugin.getZombies()
whenever you spawn a zombie, add it to that list
myPlugin.getZombies().add(theZombieYouJustSpawned)
like the FurnaceStartSmeltEvent and FurnaceSmeltEvent(finish)
it's just InventoryClickEvent
well furnace takes time
anvil doesnt
like i said just use inventory click event and check if the inventory is of type anvil
the outcome slot should be id 2
He will want to use a Map<UUID, Entity> so he knows which zombie if for each player
i want to set the required repair material to another
than the vanilla one
so
xD
?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.
Thank you
preferably at your PC, but schools think that paper is a valid answer aswell
kek
Teacher made us do our python assessment on paper Lmfao
Anyone having issues with their project not downloading required libraries?
oh you remember last night a chap was having issues with building. It would not download a dependency
is it by the bukkit api possible to change an items required material to repair it?
I shall be back in a month Lmfao
turns out he had teh scope set to shade and maven completely ignored it as a dependency to download. Not even a valid scope
wtf there is no "shade" scope
InteliJ just completely ignored it, Eclipse warned of the scope
oh yeah why didn't we see this earlier lol
it was the fifth line in the maven output lol
[WARNING] 'dependencies.dependency.scope' for com.moandjiezana.toml:toml4j:jar must be one of [provided, compile, runtime, test, system] but is 'shade'. @ line 78, column 20
Yep we both missed it
It much more of a warning in Eclipse so I saw it when I tried to compile
yeah intellij doesn't show any warning for this
I wonder why they set it to "shade" anyway lol
am i supposing it right that a material
a tool
has a hardcoded material thats required to repair it?
does someone know if File#deleteOnExit() works for non-empty directories?
the javadocs don't say anything
its name is deleteOnExit no?
oh yeah well I believe it does work, not that I tried cuz File is kinda obsolete but ye
File is obsolete? why's that?
Path ๐
many methods dont throw accurate exceptions, or exceptions at all when failing
well
Ill link you
I mean it all is just Path and the Files class these days no ?
Plugin::getDataFolder :c
flame spigot
oh well but many things simply work with Files and not with Paths
for example I'm using Zip4J and it only takes a File or String
lol very much like that
flame zip4j
I will hunt down the address of the author and burn their house down down
or I just keep using Files lol
๐ฅฒ
ugh another question about Files
FileUtils.copyDirectoryToDirectory() creates a subdirectory
is there a similar method that simply merges two folders without putting the contents of the source into a subdirectory inside the destination?
Hello everyone !
I would like to do a file inside my plugin folder to write every little information about my plugin.
Something like README.md on github...
Which extension should I use please for your opinion ?
Ty ๐
i'd just use .txt
Oh well, I though there were a "special" extension for this x)
Ty ^^
On that note, is it possible to upload a zipped folder instead of just the jar file to spigot?
yes
no
of course
๐
that works fine
but stuff like replacing the premium resource placeholders will then not work
Great, that way its easier to supply documentation
What do you mean with placeholders?
stuff like public String userId = "%%__USER__%%";
Ive never made a premium resource, would you recommend I use another way to supply documentatiin for the user?
I just always put all information on the spigot page itself
and I have a ton of comments in my .yaml files
It seems half the people who download dont read the spigot page. I suppose that is different for premium resources
yeah many people just ignore it lol
I always start my config files with general information about permissions, commands etc
and then every config option always has a huge explanation too
Oooo i usually make gigantic config files... That would make the size be like 1000 lines
wow ive written a template to allow repairing any item with any material by replacing the material on corrisponding events to the vanilla repair material
"Main" :x
yes, where's the problem?
Currently Im making a plugin where people can define their own creatures based on vanilla creatures and I need all the data for each one which is like 50 lines in itself... Commenting that is horror tbh
Nowhere, don't wanna start a huge useless debate
oki
whats the resource prompt for?
resourcepacks
i just randomly put in test-prompt and it ended up with an error
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.
i was assuming it changes the way the server asks you to change resource packs
JsonReader.setLenient(true)
add that
to your json reader
mc json isn't actually valid json
no like I'm not reading this file at all
can I see your code
its not really an issue for cause i can just leave it empty
i was just curious what its for so i just set it in server.properties as test prompt
Let's go!?!?!
just googled abit, seems like it needs to be json format
wow wtf why is that so expensive
for those prices I'd just get a dedicated server instead
almost 3$ per HOUR for 64 gb of ram?!
isn't code spaces free for individuals o.O
idk I just looked at this page
is it something that updates github as you code?
never saw this kind of thing before
no
you still have to commit
https://docs.github.com/en/billing/managing-billing-for-github-codespaces/about-billing-for-codespaces#codespaces-pricing states codespaces is free for personal accounts
oh yeah
but it's still very expensive
like after 40 hours I could instead just get a 128 GB / 32 core dedicated server at hetzner instead
and use that the whole month
Cannot wait for Fleet
to host that on a remote
and well, idk who in their mind uses codespaces
Free :)
Is there something in java like setInterval() and setTimeout() in javascript?
package fr.program.testplugin.commands;
import org.bukkit.Bukkit;
import org.bukkit.Color;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
public class AnnonceCMD implements CommandExecutor {
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
if (command.getName().equalsIgnoreCase("annonce")) {
if (sender instanceof Player) {
Player plr = (Player) sender;
if (args.length <= 0) {
plr.sendMessage(Color.RED + "ERREUR" + Color.WHITE + " | Veuillez donner des arguments pour votre annonce !");
} else {
StringBuilder finalMessage = new StringBuilder();
for (String part : args) {
finalMessage.append(part + " ");
}
Bukkit.broadcastMessage(Color.WHITE + plr.getDisplayName() + "][" + Color.RED + "ยง4ANNONCE " + Color.WHITE + " ] " + finalMessage.toString());
}
}
}
return false;
}
}
Hello guys, why I am gettings this :
?
Error?
I can send an img wait.
How can i create custom Hitboxes for armorstands?
No.
@fallow violet can you help me w this?
use BukkitRunnable#runTaskTimer/Later
Okay ty
your welcome
It comes from Bukkit...
I tried with ยง4 and I am getting something like it as well.
well just use the colorcodes provides from spigot like &5 or &9. But replace the & with a paragraph
oh really?
no its paragraph
but you can use ConsoleColor instead of Color
And because Color comes from bukkit but it doesnt mean it works in console, yk?
ยง did not work as well.
It does not give me the color. https://gyazo.com/47e6885be717efcaa3b5c7ddfcc5e67c
It gives me but, I am getting this letter "a".
I did with ยง.
1.18.1 and Java 17.
```java
package fr.program.testplugin.commands;
import org.bukkit.Bukkit;
import org.bukkit.Color;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
public class AnnonceCMD implements CommandExecutor {
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
if (command.getName().equalsIgnoreCase("annonce")) {
if (sender instanceof Player) {
Player plr = (Player) sender;
if (args.length <= 0) {
plr.sendMessage("ยง4ERREUR ยงf| Veuillez donner des arguments pour votre annonce !");
} else {
StringBuilder finalMessage = new StringBuilder();
for (String part : args) {
finalMessage.append(part).append(" ");
}
Bukkit.broadcastMessage("ยงf" + plr.getDisplayName() + "][ยง4ANNONCEยงf] " + finalMessage.toString());
}
}
}
return false;
}}
I tried with & as well -> did not work.
It does not "understand" or idk.
sorry to have to ask not that fit in java, is it somehow possible to store a "pointer to method" in a hashmap so i can call that method by the maps key?
Oh yeah thanks !
i mean like "store a method in a hashmap" or however java handles it,.. since java doesnt know ptrs
You can save functions which are basically methods
and how?
use a Consumer
Function is better cause of the return
i basically have rightclick abilities and instead of hardcoding every if else if to get the right ability i want to store them in a hashmap and target them by the items type which is also a pdc key
hm
that will be painful to handle method parameters with
why not having an enum or smth?
sounds like you should be using abstractions
You can just have a class for the ability and use that as the argument tbh
.
Or the rightclick event itself
Not that hard
ya thats what i do rn
but then i have to write it for every item
with an if else if
which is not what i want
depending on your usecase hardcoded items can sometimes be better
class Ability {
String name;
abstract void exec(PlayerInteractEvent e);
}```
anyways i'm currently having a Storage interface and some implementations for databases, should i let the storage methods return futures?
or is there a more elegant solution
Is the storage interface a direct abstraction or is it an adapter or is it some sort of facade?
i dont understand anything of that sentence lol
i was trying to abstract all the storage logic
so is this an interface to interact with a storage controller or the controller itself
That looks good
Donโt return futures in that one
Create an adapter
Which does return futures by delegating an instance of its delegate type
so like the thing you recommended me before
Yes
Well it helps with concurrency a lot (separating actual business logic and multithreading as much as possible where we have humble classes that know as little as possible about the multithreaded environment they face)
BiConsumers work perfectly fine for me
๐
no error whatsoever
functions being called properly
public boolean onRightClickAbility(PlayerInteractEvent event)
{
if (event.getAction() == Action.RIGHT_CLICK_BLOCK || event.getAction() == Action.RIGHT_CLICK_AIR)
{
ItemWrapper item = new ItemWrapper(event.getItem(), null);
if (item.getItemStack() != null)
{
if (item.isCustomItem())
{
if (item.getRightClickable() != 0)
{
String item_type = item.getItemType().toLowerCase();
if (CustomItems.itemList.containsKey(item_type))
{
if (CustomItems.itemList.get(item_type).getAbility() != null)
{
CustomItems.itemList.get(item_type).getAbility().accept(event.getPlayer(), item.getItemStack());
event.setCancelled(true);
return true;
}
}
}
}
}
}
return false;
}
only need to register the ability to my item list then
do you know about the existence of early returns?
they will kill you in your sleep if you dont use them
hi i have a gui and i want to pick ho to take money from and i don't get the code rigth i get a white line over withdrawPlayer
case WOODEN_AXE:
//Get name
String name = e.getClickedInventory().getItem(4).getItemMeta().getDisplayName();
economy.withdrawPlayer(name, 1000);
a white line over withdrawplayer?
He means depreciation probably using eclipse or something
It's super annoying that people don't learn what shit means and just describe how it looks
It definitely doesn't help people help you
yes like this withdrawPlayer
Nice
Deprication look it up
You should know what it means if your using java
withdrawPlayer
yes
See my above comment
I'm surprised mine worked fine out of box what distro
itz cuz i got it from flatpak
Ahhh
This explains it lol
now i know what it means but i see that is the string name but how can i fix it?
you dont need to fix it necessarily, it will still compile and run, but it might be better to use a method that is not deprecated
you can look at docs or see it in the autocompletion
which ones are and arent deprecated
but it does not work at all
"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.
what do you mean by "not working"
it's form vault yes and it does not take money from then like it is now
does the player has an account and has enough money?
u sure the code is being called?
i have a test server and i have 1 mil on it i think so then
yes
add sysouts then
look at the vault source
they might have removed the functionality for deprecated methods
and yeah add sysouts
but nothing happens it's just not taking money
also the method youre using has good reason to be deprecated; never use player names, just use uuids or OfflinePlayer objects
might be the problem too
What cauldron level is an empty cauldron?
id guess 0
it is not
take a look at the docs i'd say
Idk then just make a debug statement
Cannot set property BlockStateInteger{name=level, clazz=class java.lang.Integer, values=[1, 2, 3]} to 0 on Block{minecraft:water_cauldron}, it is not an allowed value
print the level
declaration: package: org.bukkit.block.data, interface: Levelled
so I need to check if it is the minimun and then set it to an empty cauldron?
i'll just cancel event
Dunno what you are doing but yes you need to change it to a plain cauldron if you want the empty appearance
Hello guys, I have a problem with my Spigot 1.18.1 / Java 18 plugin, console tells me ```err
Cannot invoke "org.bukkit.command.PluginCommand.setExecutor(org.bukkit.command.CommandExecutor)" because the return value of "my.example.plugin.Main.getCommand(String)" is null
but ... command exists in my plugin.yml
```yml
commands:
test:
description: it's a test bro
I tried to replace tabulations by spaces, but it's the same error ๐ง
Do the plug-in command name and the main class one match?
You should have getCommand(โtestโ).setExecutor(your class);
in my Main :
getCommand("test").setExecutor(new Test());
Weird
yea 
Cannot resolve method 'getPersistentDataContainer' in 'ItemMeta'
Help?
show your code
ItemStack creditStack = plugin.itemStore.getPlayerCreditCard(plugin.basicCardStack, player, String.valueOf(randomNumber));
ItemMeta meta = creditStack.getItemMeta();
creditStack.getItemMeta().getPersistentDataContainer().set(key, PersistentDataType.DOUBLE, Math.PI);
1 16 5
Ok, I understand, I use for the first time the extension "Minecraft" of IntelliJ, this one create automatically "plugin.yml", so it's doesn't read my plugin.yml
thank you for trying to help me
