#help-development
1 messages ยท Page 2125 of 1
Cause BoundBox returns a box via a location with blocks inside it,.
I need one for a sphere.
No
Why
and a VoxelShape contains a collection of boundingboxes
thats the same question im asking
Look.
Im trying to make a sphere, in which
It gets locations for each part of the sphere
checks if a block already exists there
and overwrites it
with stone
The center of the sphere, is where a block is placed
I don't think spigot has logic build in to calculate a sphere of blocks
I meann what's wrong in ut
I need a tutorial on that.
google ?
oh yea true
if youre trying to prevent command being used, why not just setting a permission for those commands?
I have a library that can easily do that
SpheroidRegion region = new SpheroidRegion(center, radius);
region.forEachBlock(b -> b.setType(Material.STONE));```
how can i convert all my args to a single string? (command: /sc words here, args will be: ["words", "here"], i want: "words here")
Could you send that? Or would it be better for me just to use WorldEditAPI
String.join(" ", args)```
What if it's a cmd from any other plugin
thanks
Is it possible for me to check if something isnt the instanceof a class?
if(!(something instanceof class))?
ty
b.getLocation().add(0,1,0).getBlock().getType() == Material.AIR
Is this how id check if the above block is air?
can i get persistant data from an offline player?
https://hub.spigotmc.org/javadocs/spigot/org/bukkit/block/Block.html#getRelative(org.bukkit.block.BlockFace) might also be easier
declaration: package: org.bukkit.block, interface: Block
hey so I have a class that stores an arraylist of a custom object i made for shop entries, and builds a shop inventory based on that. How can i check in InventoryClickEvent that the inventory that was clicked is this one specifically, and also is there anything i can store in the item clicked that can trace back to the shop item that was clicked? The item is paper and invisible btw, but there are 4 of them per shop item.
not with plain spigot
no
oh wow
thank you
never knew there were different types of air
ayy that looks cool
sorry to be weird
but how did you make that?
that looks sick
custom resource pack + custommodeldata
using resource pack + custom font
oh with fonts? I've only seen it using modeldata
the title has all the images
wait so, can the number change?
the 10
eventually im gonna add that in
wait is Map<UUID, int[]> valid java?
you can do with modeldata but I didnt want it to be picked up for a brief sec
i guess not
what version of mc u working with?
1.18.*
ok yeah it will work
erm yes sure, why not?
i was thinking that id need Integer[]
aah
As all arrays are objects
how would I place a block lol
Which uhm might be unexpected but that is actually the case
get the block at a location and set it's type
if you want, you may need to emit events, but really it is that easy
oh wow
and this is why java is better than python
" ".join(args) :d
:)
how can i check if an inventory is a specific one without checking the title?
.equals?
you can check for example if first item is glass or sth
items will be different for every player
unless i can store the inventory to the player and check that way?
what are u going to do with plugin?
itโs a shop thats built every time the player opens it based on their items
i think u can do it with map
.getDisplayName().equalsIgnoreCase(ChatColor.WHITE + "Wybierz rolฤ"))```
check the CraftInventory::equals implementation id say
Object.requireNonNull
Why
the orange underline irritated me
i hope he knows what that does
so you prefer throwing exceptions instead of handling cases correctly?
It can throw NPEs
Just do null checks man
๐
btw
LogTools.log("saving crim spawns");
Writer w = new FileWriter(crimSpawnsFile);
gson.toJson(crimSpawns, w);
w.flush();
w.close();
LogTools.log("crim spawns saved");
}``` did someone know what is wrong with this code(i'll send error message)
crimSpawn.isEmpty() is smth too x)
it doesn't matter know
Is the code not working as you expect it to?
it depends on the circumstances
at java.util.Arrays.copyOf(Arrays.java:3537) ~[?:?]
at java.lang.AbstractStringBuilder.ensureCapacityInternal(AbstractStringBuilder.java:228) ~[?:?]
at java.lang.AbstractStringBuilder.append(AbstractStringBuilder.java:582) ~[?:?]
at java.lang.StringBuffer.append(StringBuffer.java:313) ~[?:?]
at java.io.StringWriter.write(StringWriter.java:106) ~[?:?]
at com.google.gson.stream.JsonWriter.string(JsonWriter.java:586) ~[gson-2.8.8.jar:?]
at com.google.gson.stream.JsonWriter.value(JsonWriter.java:418) ~[gson-2.8.8.jar:?]
at com.google.gson.internal.bind.TypeAdapters$16.write(TypeAdapters.java:409) ~[gson-2.8.8.jar:?]
at com.google.gson.internal.bind.TypeAdapters$16.write(TypeAdapters.java:393) ~[gson-2.8.8.jar:?]
at com.google.gson.internal.bind.TypeAdapterRuntimeTypeWrapper.write(TypeAdapterRuntimeTypeWrapper.java:69) ~[gson-2.8.8.jar:?]
at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$1.write(ReflectiveTypeAdapterFactory.java:127) ~[gson-2.8.8.jar:?]
at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.write(ReflectiveTypeAdapterFactory.java:245) ~[gson-2.8.8.jar:?]
at com.google.gson.internal.bind.ObjectTypeAdapter.write(ObjectTypeAdapter.java:107) ~[gson-2.8.8.jar:?]
at com.google.gson.internal.bind.TypeAdapterRuntimeTypeWrapper.write(TypeAdapterRuntimeTypeWrapper.java:69) ~[gson-2.8.8.jar:?]
at com.google.gson.internal.bind.MapTypeAdapterFactory$Adapter.write(MapTypeAdapterFactory.java:208) ~[gson-2.8.8.jar:?]
at com.google.gson.internal.bind.MapTypeAdapterFactory$Adapter.write(MapTypeAdapterFactory.java:145) ~[gson-2.8.8.jar:?]```
java.lang.OutOfMemoryError: Java heap space kekw
yes
but why i have no memory?
wait
IO Exceptions? Generally just kill the process. NPEs? Kill the process. The only time where I do have exceptions correctly is for ThreadDeath and reflective exceptions
this code was working one week ago and know i opened project and it's not working
Generally means that you have a deadlock or you have just struck malware
I.e. https://en.wikipedia.org/wiki/Billion_laughs_attack can cause such issues
id say open taskmanager and check how many % of your memory its consuming
but i mean, it's problem with gson library
becouse when i skip code with gson it work
what are you parsing?
map with mafias which are have owner members etc.
but on other project this code work perfectly
lol
ExampleClassGson exampleClassGson = new ExampleClassGson(15, "dawid", new Adress(1, "warszawa"));
Gson gson = new Gson();
String gsonClass = gson.toJson(exampleClassGson);
System.out.println(gsonClass);
}``` i mean this code
and what are the fields of ExampleClassGson? It is possible that you have some recursion at play, though it surprises me that there is no stack overflow
you need to first apply the lore and after the meta
oh really
Let me try
Yep Thanks ๐
And How Can I remove text of +7 Attack Damge from there?
public class OnPlayerChat implements Listener {
@EventHandler
public void onPlayerChat(AsyncPlayerChatEvent event){
if(event.getPlayer().getName().equals("AnEmerald")){
String Char = String.valueOf(0xE001);
event.setFormat(Char + " " + event.getFormat());
}
}
}
Why isnt this showing my texture packs image VIA chat
You are looking for free hosting
it just says 57345
what
Free hosting for Minecraft
Nvm I solved it
dunno what you are trying to do, but 0xE001 is just an int
String Char = String.valueOf(0xE001); hmm
sadly naming the variable to Char wont have the effect of making it to one magically
lol
๐คก
{
"providers": [
{
"type": "bitmap",
"file": "ui/finalOwnerTag.png",
"ascent": 8,
"height": 16,
"chars": [
"\uE001"
]
}
]
}
its a bitmap
Yea then just define the char like that ?
hello, quick dumb question, is it okay to put two commands in a single onCommand() ?
ye but i prefer putting all my command in their own class
okay but not recommended tbh
yeah but to practice, i'm trying to code a plugin like essential which has a ton of commands (good practice imo)
so I have to create a class per command ?
ye
@eternal night Now it just makes a []
Can I create an inv in a class and add items to it in another ?
Yes
It's finee
i asked more stupid questions when i was here at first
I'm coding a plugin for 1.8.9, is there any java/spigot stuff I shouldn't use ?
Anybody got a plugin idea?? (Useful)
Everyone does
Bounty gui book
Elaborate please
if i set a block to be powered (redstone) do i have to manually unpower it if it recieves no block updates, or does that happen 2 ticks later naturally
Oh Why It Doesnt Work?
eh whatever i have written a test effect for stuff like that
./bounty add (adds a bounty to a player or adds onto an existing player's bounty, not self)
./bounty menu (opens the bounty gui, with all the bounty set by players on other players)
./bounty pay (Pay your own bounty to remove it from the menu)
If you kill a player with a bounty, you get the money on his head
bascially
aint a switch restricted to primitives + string
Enums as well
Nice
no idea then
Inventory name doesn't have colors iirc
I tried with colorless too but doesnt work
Debug using print statement?
There is no error
I mean check where the code reaches
Oh Bro
Guess. Do you think Who didn't add Listener to implements?
best way to make inventory click stuff is to write a class that wraps an inventory and has consumers for each item in the inv
Class for each Item or Class for all of them ?
yesss
Wait what does it public void fill doing
filling the whole inventory with a filler item (black glass)
Ohh I see
i was doing stuff like Optional.ofNullable(items.get(slot)).ifPresent(InventoryButton::onClick) but i thought lets not do that :'(
https://paste.md-5.net/lifagiveda.sql why is this happening?
Hello, it is possible to put a block in an hashmap ? For exemple When i click on a diamond block, it put in the hashmap the playerId and the location of the block
Map<UUID, Location> then
you can also put the block itself
dunno what you would do with a block object x)
oh nice how ?
Map<UUID, Block>
someMap.put(player.getUniqueId(), event.getBlock())?
Nice, I say thanks u
: )
wdym? s
but it does exist...
on that path?
the class in an enum?
god you code like nms ๐คฎ
never saw anyone doin that
yes i did that because of lack of fantasy
i wanted trying
yesterday i asked if it was possible
iirc mfnalex said yes
You don't need an obfuscator if the code you write is unreadable in the first place
win win situation ๐
can we tell the difference apart
nop
And why is it always pet plugins too
uhm i would try that im not sure
I have never seen a well-written pet plugin
or crappy versioning plugins
i'm not always doing pet plugins. in fact this isn't a pet plugin. this is a core plugin for a server which include pets
That's not what I was saying
sorry then
pov: pet plugin
That error usually happens when you try to save something to config that is not primitive or ConfigurationSerializable
In this case it looks like you tried to save a PetInstance to config
could be that Player is not ConfigurationSerializable
for example
wtf
true but that class implemented configurationserializable and also all of the methods
where's da 800 lines long switch?
not 800 but close enough
How would I use InventoryOpenEvent ?
That's a really vague question
well like do something when a specific inv opens
If you have a reference to the inventory
or an inventoryholder
You can just do e.getInventory().equals(yourInvHere)
I need the event when a specific invs opens
Again
You can just do e.getInventory().equals(yourInvHere)
should i add placeholderapi support?
great question
.-.
what context
probably wanting to listen for InventoryClickEvent then
well
what were you doin again?
Asking extremely vague questions
hmm thats a good one
Guys what do I do with regex??
eat it
custom messages for kickall atm
yes?
Seems like it would benefit from papi support
ok
How do I use spigot ?
Have you tried walking into the sea
How do i can check if the clicked block is already in an hashmap ? please
whats java
if i see md5 ill ask him to add an :checkTheDoc: emoji
containsValue
But you shouldn't be using containsValue
You should be using a separate Set<Block> or something
public void onOpen(InventoryOpenEvent event) {
Player player = (Player) event.getPlayer();
Inventory inv = event.getInventory();
}```so that'd work right ?
ye
damn
Thanks u, i will paste my code if you want to check
easier than my brain can process
I did
ah
just sent you this tiny bit
how dare you
sorry
@EventHandler
public void interactDoor(PlayerInteractEvent e){
Player p = e.getPlayer();
if(Objects.requireNonNull(e.getClickedBlock()).getType() == Material.ACACIA_DOOR && e.getAction() == Action.RIGHT_CLICK_BLOCK && Objects.requireNonNull(e.getItem()).getType() == Material.PHANTOM_MEMBRANE){
if (buyDoor.containsKey(p.getUniqueId())){
p.sendMessage("YOu have already this house");
e.setCancelled(true);
} else {
buyDoor.put(p.getUniqueId(), e.getClickedBlock());
p.sendMessage("You buy this house");
e.setCancelled(true);
}
}
}```
?paste
```java
code here
```
Yeah or that for short blocks
lot to learn lol
This is a terrible idea
Why are you doing Objects.requireNonNull there
Wdym
That's going to just throw an NPE if a player ever interacts with air
cuz he saw someone doing it
You're going to spam your console with errors
Removing Objects.requireNonNull is not going to fix it, either
It's just going to make it spam NPEs instead
Yes thanks i just remove
You can really easily just change the order of your conditions
e.getAction() == Action.RIGHT_CLICK_BLOCK && e.getClickedBlock().getType() == Material.ACACIA_DOOR
Thanks to short circuiting this will never throw an NPE
nice thanks for the tips
How do I find text in a string, and replace it?
just realized that the block wont be null if the action is clicking a block ๐คค
.replace
And when i put the containsValue, I just put p.getUnique and p.getBLock ?
Use a separate Set<Block> rather than containsValue
containsValue will iterate over all the entries in the map to check if the value is contained
A Set<Block> can determine if a value is contained in constant time
Nice, thanks u a lot
does replace error if the string doesnt contain the required text
to replace it
i dont understand how papi works, do i need to make a placeholder expansion in my plugin?
if you want your plugin to provide a placeholder ye
ok
how come i can use gradlew.bat prepareKotlinBuildScriptModel in terminal but when i let intellij do it to update the gradle changes it errors with ```Could not find spigot-api-1.18.2-R0.1-SNAPSHOT.jar (org.spigotmc:spigot-api:1.18.2-R0.1-SNAPSHOT:20220408.234706-30).
Searched in the following locations:
https://hub.spigotmc.org/nexus/content/repositories/snapshots/org/spigotmc/spigot-api/1.18.2-R0.1-SNAPSHOT/spigot-api-1.18.2-R0.1-20220408.234706-30.jar
Possible solution:
- Declare repository providing the artifact, see the documentation at https://docs.gradle.org/current/userguide/declaring_repositories.html
What's the difference between SpecialSource and SpecialSource2?
the one is 2 and the other isnt
Wow thank you!
someone help?
how can I only allow players to break blocks that they build for them selfs, currently I have an areaylist, to store player placed blocks in it, but what if the server would restart or crash? the list would be gone
and there would be no way to reset it
is that part of a minigame?
if so i dont think you should store them over reloads
otherwise just save the locations to a file/database or smth
it is an bedwars base protection
if you want your game to continue after the server restarted, save the stuff to a file/database
Yeah
Preferible working over a cache and save it on important update and every time into database
dunno if hes actually creatin a kind of game like hypixel skywars
No lmao
I code a plugin for a client that told me that its must contains cache the plugin
If not he wouldnt accept it
makes sense no?
Of course it makes sense
Caching make things more quick
Because you are not everytime writing to database
And i dont tell you If you dont write database in Async
๐คฃ
if (current.getType() == Material.LEATHER_HELMET || current.getType() == Material.IRON_HELMET)``` Does that work to check if current is either a leather or iron helmet ?
writing to the database sync can be useful
oh no a customer expects an actual plugin that doesn't burn their database
yes
Why would it display like this then ?
String PlaceholderFilled = PlaceholderAPI.setPlaceholders(loopPlayer, Bukkit.getPluginManager().getPlugin("GeneralUtils").getConfig().getString("messages.kickall-message"));
^
symbol: variable PlaceholderAPI
location: class KickallCommand```why do i get this?
idk its eclipse :kekw:
i dont like it
looks like some 50 y/o program
Eclipse its shity for me
anyone?
That should be supported on a placeholder discord
ok
For Java I recommend Intellij idea
it does handle js and python though
with a hundred extensions it finally approaches the definition of an ide
For example intellij allow to refactor a +100 packages group id to another in less than 5m
๐
so intellij > eclipse ?
In my opinoon Intellij its 90% better
The main issue is that its not to much optimized, so it will fuck your ram
hahaha
Agree
Eclipse is fine but its UI is a bit meh
Only ui, are you drunk my bro?
nah
intellij is stupid when it comes to optimization
Eclipse is so shity that doesnt have tab completation
it wasnt particularly slow for me
it does though
I have it
i remember when i upgrades intellij to like 2020 from like 2019 and everytime i loaded an enum it would die for like 1 minute
That another point that we everybody hate it
upgraded*
i went eclipse -> netbeans -> intellij ce -> intellij pro or whatever tis called
is it safe to completely disable moved too quickly or moved wrongly check from PacketPlayInFlying?
https://imgur.com/a/ToHCzQF
Are they just an internal anticheat or do they prevent exploits/lag?
eclipse before netbeans?
just kicks the user if theyre doing weird stuff
thats an interesting one
their built in "anticheat" for allow flight sucks
yeah xdd
there was a time i used netbeans
I cannot fuck i used to code java on 2019 using Intellij with only 4gb of ram and never had big problems hahaha. Now i have 32gb of ram and a Ryzen 7 3800x and i cannot fuck
i just liked netbeans built in browser i believe it had for web apps
the ui's a little bit better than eclipse but thats all lol
u cant fuck? ๐
Isnt fuck == joder?
!=
Im spanish
whats joder
lmaoo 32gb ram is gonna be my laptop for uni
And even more im from latam and i have a decent pc
I cannot complain about that
Fortunatly im from Uruguay where it doesnt have as many problems and its stable
i should probably upgrade
If I set an item in a gui where another item is, will it override it and put the new one ?
ye
pc starts lagging with mc, ij and mc server open
what about that claims plugin?
๐
uh we can
I need to talk someone i actually dont have friends
best thing i heard today
I have moved this year to new highschool and most of my friends dont even follow me on instagram
eclipse -> intellij ce -> made an evaluation resetter for intellij ult LMFAO
lol its just instagram
I mean perhaps thats not even necessary in order for you guys to become friends
but why
why instagram
just use spigot irc
?irc
IRC Chatroom: https://www.spigotmc.org/pages/irc/
๐ฅฒ
Begins singing mad world or the sound of silence

I don't like something in the irc panel
The x's here are miniscule
ads have bigger x's
but irc
hmm 23:23
what are irc commands?
idk
what does irc stand for
Internet Relay Chat or smt
oh
yeee
it was you
good
What the codec audio on discord?
Discord epic shitcodecโข๏ธ
event.setCancelled(true);
item.setAmount(item.getAmount() - 1);
SpheroidRegion region = new SpheroidRegion(block.getLocation(), 15);
region.forEachBlock(b -> {
if(b.getType() != Material.AIR && !(block.getState() instanceof TileState)){
b.setType(Material.DEEPSLATE);
}
});
Is there a reason why my block isnt updating?
AKA: Its not removing hte item, or anything
?paste
you compiled with java8+?
16 I believe
and the server is running with java 8
how do I know that ๐
'plugin has been compiled by a more recent version of java'
@EventHandler
public void onBlockPlace(BlockPlaceEvent event){
Block block = event.getBlock();
ItemStack item = event.getItemInHand();
PersistentDataContainer pdc = item.getItemMeta().getPersistentDataContainer();
if(pdc.get(NamespaceKeyList.getKey("gemCatalyst"), PersistentDataType.STRING) != null){
event.setCancelled(true);
item.setAmount(item.getAmount() - 1);
SpheroidRegion region = new SpheroidRegion(block.getLocation(), 15);
region.forEachBlock(b -> {
if(b.getType() != Material.AIR && !(block.getState() instanceof TileState)){
b.setType(Material.DEEPSLATE);
}
});
}
}
Any reason this doesnt work?
No blocks are replaced, and the item amount isnt changed.
Yet, the key is valid.
And, it cancells the event.
how do I fix it ?
what mc version is your server?
1.8.9
eclipse
then i dunno how to change it
do a quick google
1.8
thanks
ezz
Why won't inventory.clear() clear armor slots ?
clear equipment
they're on 1.8
ye it was skull back in ye ole day
So I need skull to put a player's skin on it ?
SKULL_ITEM iirc old versions
?paste
05.05 00:07:16 [Server] INFO Caused by: java.lang.ArrayIndexOutOfBoundsException: 4
05.05 00:07:20 [Server] INFO at fr.frenchkiwi.kiwipvp.kiwiListener.onClick(kiwiListener.java:66) ~[?:?]```
kiwiListener.java:66
Uppercase your classes please
my line 66 is empty
did you remember to build the plugin
yes ?
well if your line 66 is empty the plugin on the server clearly isnโt the latest build
well new error now lmao
And for as much as I could understand the last error, this one is really confusing
it appears whatever item meta you were trying to cast was not an instance of skullmeta
could you share your code
skullMeta.setOwner(event.getPlayer().getName());
this ?
no
the entirety of my code ๐
does anyone know how to calculate blocked and critical hits
where is the part where you are actually casting it
I cast it in two parts of the code
like I change the display name at different places
1738
skullMeta.setDisplayName("You have " + points + " left");
skull.setItemMeta(skullMeta);
inv.setItem(1, skull);``` I have this twice in my code, in different events
is this a learnjava moment
ItemStack skull = new ItemStack(Material.SKULL);
SkullMeta skullMeta = (SkullMeta) skull.getItemMeta();```
sorry mate
I got confused
OHHHH
i'm trying to change the display name from a skullMeta and not an item meta
could that be the error ?
then idk
do you actually read the error you're given
05.05 00:28:25 [Server] INFO java.lang.ClassCastException: org.bukkit.craftbukkit.v1_8_R3.inventory.CraftMetaItem cannot be cast to org.bukkit.inventory.meta.SkullMeta
05.05 00:28:25 [Server] INFO at fr.frenchkiwi.kiwipvp.kiwiListener.<init>(kiwiListener.java:17) ~[?:?]
``` what's there to not understand
the error is that
you arent making it a playerskull
its just a skeleton one
you need to set the damage value
CraftMetaItem cannot be cast to SkullMeta,
at fr.frenchkiwi.kiwipvp.kiwiListener.<init>(kiwiListener.java:17)
class kiwiListener.java, line 17
but you guys told me I couldn't use PLAYER_HEAD earlier
what is that ?
a value on items in 1.8
that determine what type they are
cobblestone, stone, andesite, etc
actually cobblestone might not be a damage value of stone
but you get the point
I don't recommend trying to learn legacy api, most people wont even give you help with it
start with something more recent if you're learning
Should I just give up on this for now in 1.8 ?
my server runs 1.8
well you would need to change that if you were to code on a later version wouldnt you
everything works fine, thanks a lot everyone
how to make player unride
leaveVehicle
if you want to, up to you
how do i define this as an adult
Horse horse = (Horse) player.getWorld().spawnCreature(player.getLocation(), EntityType.HORSE);
you're asking some very trivial questions
horses dont spawn as adults?
@hexed hatch
Okay so. I have an InteractableItemStack class, as you're aware. This class would be extendable to allow custom actions for specific item stacks.
e.g. A stone named Ban Me would ban the specific player. The issue is if there's 2 stone ItemStacks which do two different things, e.g. Kick Me, and Give me a diamond. The previous idea HashMap<Material, InteractableItemStack> would work, but only if it was certain a material would be used one.
The issue now is properly storing the ItemStack/Material/Info in a way to easily get and run the correct method
i.e. Kick Me always gets and runs the class that kicks the player, and Give Me a Diamond always gets and runs the class that gives the player a diamond
If it were me, I would give every custom item a PDC string value
and this would be the key for the item
I'd have HashMap<String, InteractableItemStack>
why isn't leaveVehicle working?
I always forget PDC is a thing lol
It's a lifesaver
and and and
people can rename the item
and it still works
Before this, I did exactly what I mentioned above but with localized name
which is also a out of reach value for items
The custom items would not be renamable, thankfully lol
but PDC is much better for this I'd say
and if they somehow get renamed, I'd have more important issues to worry about ๐
Well with PDC, you can let renamability be an option
then with the plugin you can just allow/disallow it
well yea lol
I actually did exactly this with localized name for a old plugin of mine for detecting custom items
worked beautifully
nope
now I just have to figure out the whole PDC thing lol
The issue is actually finding docs or at least an example ๐
I'd be happy to walk you through it personally if need be
you're going to need a NamespacedKey first
Yea, I figured it out lol
all I need to do now is modify the class to properly make use of it, as well as make a manager then everything's good
which will actually a tad annoying, given how I'm going about it, though I can always just do an item builder lol
no real non-annoying way to do it though >.<
What you thinks is hard
Making a resource pack or making a plugin
Per plugin basis
999999999999999999999999
Exactly.
Please if you dont wanna say it, just tell me dont worry. But i dont like jokes
I can be really agresive
Resources pack isn't hard right?
I've been trying to use worldedit in my plugin to do stuff like pasting structure files on events, but when I try to maven install, I am getting the error that the worldedit package does not exist. I have downloaded the worldedit api and included the jar as part of my library. Am I supposed to do something like include it in my pom xml or something as a dependency/repository?
Have you tried invalidating cache?
oh I dont think I have, ill try doing that ty
No clue, I haven't used those before
Is paper supported here
Got banned
lol you're screwed then
appeal :3
This isn't paper's support server and if you can't go there, you'll just have to hope they have a section on their forums
Assuming you're not banned there too
Not banned on forums
Dev on Spigot and test on Paper, then get support here
You'll have to hope they have a section to get help lol
Depends on if they're using paper only api ๐
?paper
no?
?paperdev
Make sure to ask in the appropriate server concerning development towards different JAR types such as PaperMC. (Tip: Google them!)
Movement detection and block place ment is a spigot Api right?
ok I invalidated cache and restarted but I still get the same error when I maven install
Yes
Have you looked at EntityDamageByEntity event?
looks like there is no damage
so event is not fired
They should work as the same thing
There may be no way then
dam
Even though TNTPrimed is not damaged, have you tested the event to see if it is fired?
Check EntityDamageEvent too (its parent)
how do i make a resource pack for a plugin
Google, as resource packs are not Spigot related.
All I need to do now @hexed hatch is find some way to abstract this enough to not be shit and OOP friendly for multiple plugins & item stacks, but I can do that after first impl lol
If you get stuck making a resource pack, come back here and ask specific questions. You may get answers
ok
bumping this problem if anyone has any idea, ive already tried invalidating cache but that didnt work. help is greatly appreciated!
Yes worldedit has to be in your pom to use it
Itโs at that phase where Iโm not very skilled
Yea I know lol
Abstraction is something I just havenโt totally familiarized myself with yet
I need to sit down and just take time to learn it
not a thing lol
But Iโm lazy
I gotchu
โค๏ธ
I love being unhelpful
enityexplodeevent
then getBlocks
here is a premade pom that I use https://paste.md-5.net/obajadovuf
or something like this
ty
alright
u guys
are weird
I got one
ah ty, do you know what to include? I tried searching up what im supposed to put there for worldedit but I cant find it
google: worledit maven
hello guys, so I'm attempting to make a console reader type of application, but I'm having technical difficulties reading the spigot's console,
I was thinking it could be that the console has that > to type the command in, is there a way to make it not appear at all?
wdym
like I cannot use another application to read the console
for like, testing
I mean this.
is there any way, like with a argument while starting java or smth?
sorry! Found it, it was just adding -nojline when starting spigot!
Is there a way to reset someone's "sleep schedule" as if they had slept
My intentions are to prevent spawning phantoms
Player#somethingsomething with insomnia
but that's unnecessary iirc
because you can just use /gamerule doInsomnia false
I want to make an easy to use plugin that anyone can use
then yeah, just modify the player's insomnia value
There isn't a method like this.
Could be
might have to do NMS for this to set their sleep ticks
I found a plugin called "SoloSleep" I'm just going to decompile and see what it uses
ah, it's player.setStatistic(Statistic.TIME_SINCE_REST, 0)
Feel like I'm missing something lol
depend: [Core] and the dependency is definitely called Core
So I'm trying to make a plugin that adds in the armor stand posing behavior from Bedrock Minecraft. In Bedrock, the player shift right clicks an armor stand to change it's pose, and it kind of cycles through in a order
Try shading
I'm struggling to figure out how to set up that order in my plugin
Can't. It's a proper plugin, not just API/Library
Like, let's say I have pose A, B, C and D
If the armor stand is on pose B, what would be a good way to determine what's next?
Shade the entire plugin? It's custom coded, correct?
Not gonna work, it has its own extends JavaPlugin and such
Send your pom
Also not sure what extending JavaPlugin and such would do to change the fact that you can shade the plugin
try to forceload it before?
Pom's not needed in this case, the issue afaik is that it's either 1) Not detecting the depend or 2) I fucked something up somehow
The pom dependency anyways is
<dependency>
<groupId>optic_fusion1</groupId>
<artifactId>Core</artifactId>
<version>0.5.0</version>
<scope>provided</scope>
</dependency>
Make a list of the poses
A .jar can only extend JavaPlugin once
If your poses are stored in order then you could just get the next one in the list. There is some simple math for rollover.
Am well aware of that
try adding
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.2.4</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<createDependencyReducedPom>false</createDependencyReducedPom>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
</resource>
</resources>
</build>
to your pom
is the plugin.yml name also just Core?
I don't see how that'll help @tranquil viper
Yea, which is annoying lol
shading it in will not help
Everytime I get a class not found exception I shade it and it works
They are stored in an order, but it's not a static order. Poses can be thrown in and they're identified as of now by a string
do you want Core to load before or after
Before, seeing as the plugin in question uses functionality from said plugin
Wow I actually cannot communicate this properly
So then how do you change poses currently?
yeah I answered my own question
Add soft depend of the plugin you're using
Required dependency.
then add it as a depend
I did lol
odd
That's why I'm confused, it should be working as intended
maybe try to use loadbefore on Core? kinda hacky
No, then I'd have to update that every time a plugin uses the Core plugin as a dependency lol
I'm still in the setup stage. I guess I'm trying to figure out a good data structure to:
- identify the pose by a string
- have it in an order
- be able to get the next pose by getting the current one
Like, if it's on a pose named "bob", with what data structure could I check to see what comes after "bob" in a sensible way
I'm not sure if that makes any sense whatsoever
I may be approaching this wrong by using name to identify it, but I'm not using numbers because poses can be loaded/unloaded at any time basically
Well using strings for the poses may not be ideal. Since there could be any number of ways to order them.
Alphabetically, Longest name first, Shortest name first, etc
I'd recommend using numbers instead, but a list should preserve the order regardless. I don't think there would be any issue with them even if they can be randomly assigned/chosen.
Linked List?
I mean, I do have a method for getting the next string in a list, but it works off of the order of the list itself.
public String getNext(String element) {
int index = myList.indexOf(element);
if (index < 0 || index + 1 == myList.size()) {
return myList.get(0);
}
return myList.get(index + 1);
}
public String getPrevious(String uid) {
int index = myList.indexOf(uid);
if (index <= 0) return myList.get(myList.size() - 1);
return myList.get(index - 1);
}
That seems to be exactly what I need, or at least what I thought I needed
but I kind of realize now I should just refer to the pose as a number in the PDC and just increment it
because even if the current pose was removed, it'll just go to the next one without issue
I appreciate the help
Will these poses be customizable by the end user?
No, or at least not in the first version
it's intended to replicate the behavior in bedrock edition for changing poses
a set of curated poses you can just swap through by shift right clicking the armor stand
Ah, well if you want to let users add more, then use the methods above. Otherwise, you could just cycle through an Enum. Here's an example from one of my projects.
private static final ParticleQuality[] values = values();
public ParticleQuality getNext() {
return values[(this.ordinal() + 1) % values.length];
}
public ParticleQuality getPrevious() {
if (this.ordinal() == 0) {
return values[values.length - 1];
}
return values[(this.ordinal() - 1) % values.length];
}
I'll be honest in that my understanding of enums is limited, but wouldn't a enum approach not allow for data driven poses?
Yes. If its data driven, then don't use an Enum. It's just that if you are only wanting a fixed amount of poses, using an enum might be easier.
the poses will be loaded from a yml file
When I said curated, I mean curated by the server owner and not the plugin itself
but players on the server, as of now at least, won't be able to design poses
Gotcha, then the previous methods should work just fine. You may need to adapt them a little, but they make it so that the list will rollover.
So that you can go from the last pose directly to the first pose or vice versa.
Fixed my issue, no clue what fixed it though lol
Is it possible to call an event (InventoryClickEvent), inside itself ? I need to change the clicktype and make the other plugins identify it.
You can execute any event you want, but it's unexpected behaviour, so there is no guarantee all plugins will understand it
hoe can i get blocktype in str from event.getBlock()
getType
call it on the block
thanks
Block playerHead = b.getLocation().add(0, 1, 0).getBlock();
playerHead.setType(Material.PLAYER_HEAD);
Skull head = (Skull) playerHead.getState();
head.setOwningPlayer(Objects.requireNonNull(Bukkit.getServer().getPlayer(skullIdent)));
head.update();
Is there a reason my head isnt updating?
Skull ID: eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvM2JmMDdhODcyYmJjOTg1YTZmMWE1YTI4M2IzYTZmNjVmMjgzZjM0YjEyZjE0NTY5MWZkOTQwYTVkZTNkNGExMiJ9fX0=
well you could try a head replacement
maybe its defective ๐
How would I do that
well, that usually invovles separating the head from the body and putting a new one on
however, modern medicine hasn't gotten to the point of being able to successfully do that so that may not solve your problem
so we could go with the next best thing, we could just reboot it
ARE YOU TALKING ABOUT HUMANS OR MINECRAFT
Lmao
so the reason the skull is probably not updating is if the player is not on the server
if that is the case due to the methods you are using, wouldn't cause it to update
I was messing with you earlier to see how long it would take for you to realize I wasn't referring to MC ๐
Yea it clicked into my head when you said seperate
and modern medicine
lmfao
Can ya post the full error?
Yes the plugin.yml needs to be in a resource folder.
his structure is fine as he's not using any build tool
?paste the full error stacktrace
Ah thanks had no idea ๐
did you actually build your plugin? The error says Cannot find main class ga.darren.darrenmc
I use javac to compile
It found the plugin.yml in your jar but no actual java classes
Inside the jar
look inside the ga.darren folder in the jar
Open that folder
then fix the path in your plugin.yml to the correct place
So it's ga.darren.darrenmc.darrenmc
if you have a class file there, yes
BTW class names should start with a capitol letter
Capital
I guess I'm correcting your methodology so you correcting my spelling is ok
Should I try loading it now?
if you fixed your plugin.yml, yes
It works but why there is a * after the name
My guess looking at a mobile screen I'd say its disabled
So find the startup error
No errors also
But I found a logs that say it's a legacy plugin
It's detecting a legacy version since api-version is missing in your plugin.yml
Wrong message?
Yes
Add the api version entry in your plugin.yml
But what version
the lowest Spigot version you want it able to run on
1.16.5
So
api-version: 1.16
?
yes
How can i prevent a player to execute a command while he is already in a scheduled command
what is a "scheduled command"
A command whuich is already in process
You are looking for free hosting
is it possible to make a recipe which will work on throwing items on ground?
Works alr lol
i trying to create a recipe which will work on throwing specipic items in a cauldron and then a lightning will summon and player will get the output of the recipe
i'm adding config files to my bungee plugin, do you know where i should put config.yml?
public void onDrop(PlayerDropItemEvent event){
Player player =event.getPlayer();
Item item = event.getItemDrop();
if(event.getItemDrop().equals(Material.DIAMOND)){
player.sendMessage("Why are you so noob");
player.sendMessage("Get nethrite");
player.getWorld().spawnEntity(player.getLocation(), EntityType.LIGHTNING);
}
}
This code is suppose to summon lightining if we throw diamond on ground but thats does not happens and no console error
did you forget @EventHandler ?
nope
the event is registred ?
?
event.getItemDrop() return an Item, not an Itemstack
yah buat atleast it should send the message
you need to change the comparison
Yes
event.getItemDrop().equals(Material.DIAMOND)
needs to be
event.getItemDrop() == Material.DIAMOND
Enums & Primitives using ==
Objects using #equals(foo)
thanks
why?
Well that event gets thrown for every item dropped
so in a way it already does it for multiple items
i mean if i throw diamond and diamond block both then
the code i wrote earlier instantly summons lighning
on one item
and player wont get the chance to throw another
I mean i have a scheduled command, during the process of this command player wont be able to use another command
You are not explaining a "scheduled command"
How do I make a player face a block?
What thr fuck can i explain
Well, two people have now asked you what you mean by a "scheduled command" as no one understands what you are asking
Scheduled command
No one here understands what a "scheduled command" even is
When you enter a command
How is a command suppose to keep running lmao
Oh i see
ฤฐt repeats for 20 seconds
its simple
command with cooldown
Do you mean that the one command blocks other commands from running while it is activve
make a hash map and store command cooldown
Whaa
oh
ok
so
What is command cooldown
like that the command is a single thread
a simple boolean could work
How to use it
once a command gets used
the plugin waits for that command to complete
then other commands can run
basically a blocking thread
ok so nothing to do with any scheduling, just a cooldown
kinda like async/await
Do you mean you don;t want ANY commands run, or just not YOUR commands to run?
No like make a hash map to see if player is available for next cmd or not
ie, they run one of yoru commands and they are then blocked for x minutes from using that same command
private final HashMap<UUID, Long> cooldowns = new HashMap<>();
public Long getCooldown(UUID id) {
return cooldowns.contains(id) ? cooldowns.get(id) : -1;
}
public void resetCooldown(UUID id) {
cooldowns.put(id, 0);
}
public void setCooldown(UUID id, long cooldown) {
cooldowns.put(id, cooldown);
}
// in command method
if(getCooldown(player.getUniqueId()) - System.currentTimeMillis() > 0) return;
resetCooldown(player.getUniqueId());
// stuff
setCooldown(id, 500); // half a second of delay
example
is there anyway to do floor crafting ? or is there any api for it?
public class MyPlugin extends JavaPlugin {
private final HashMap<UUID, Long> cooldowns = new HashMap<>();
@Override
public void onEnable() {
// Your stuff
getCommand("mycommand").setExecutor(new MyCommand());
}
public Long getCooldown(UUID id) {
return cooldowns.contains(id) ? cooldowns.get(id) : -1;
}
public void resetCooldown(UUID id) {
cooldowns.put(id, 0);
}
public void setCooldown(UUID id, long cooldown) {
cooldowns.put(id, cooldown);
}
// Do this as a convenience method
public static MyPlugin getInstance() {
return JavaPlugin.getPlugin(MyPlugin.class);
}
}
public class MyCommand implements CommandExecutor {
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
MyPlugin plugin = MyPlugin.getInstance(); // Too lazy to type dependency injection in discord
long timeRemaining = plugin.getCooldown(player.getUniqueId()) - System.currentTimeMillis();
if(timeRemaining > 0) {
sender.sendMessage("You need to wait " + (timeRemaining / 1000) + " more second(s)!");
return;
}
plugin.resetCooldown(player.getUniqueId());
sender.sendMessage("Heyo");
plugin.setCooldown(id, 500); // half a second of delay
}
}
@modern vigil
?
command with cooldown
is it possible to make floor crafting?
wdym
crafting by throwing items in floor
you need to change the yaw and pitch, i will send an example wait
to face a block
https://youtu.be/w-srnRtbCeo like this but in coding
just listen to item drop events & handle them