#help-development
1 messages ยท Page 1453 of 1
yeah i don't fucking know use a set or something
I see no reason why it shouldnt be working lol
if (cmdName.equals("lock")) {
if (args.length == 1) {
if (args[0].equalsIgnoreCase("set")) {
MagmaBuildNetwork.playersWantingLock.add(p.getUniqueId());
sender.sendMessage(ChatColor.DARK_GREEN + "Right click a block to lock it!\nOr type /lock cancel to cancel");
} else if (args[0].equalsIgnoreCase("cancel")) {
MagmaBuildNetwork.playersWantingLock.remove(p.getUniqueId());
p.sendMessage(ChatColor.DARK_GREEN + "Cancelled!");
} else if (args[0].equalsIgnoreCase("remove")) {
// TODO add method to make container public (lock.remove)
}
}
}
for some reason it just returns this when i do /lock set
yea but where?
in the command executor
returning false has the command usage printed to the sender
lmao i'm stupid
if you haven't set a command usage, the command's name is printed instead
use an api such as CLOUD, Brigadier or Commodre
what
i don't understand
what is a namespacedkey
i am trying to make that error disappear from a older plugin
namespacedkey is a NamespacedKey
it represents a key with a namespace
f.e minecraft:dirt is a namespaced key
minecraft is the namespace, dirt is the key
ok thx
with which event would i check if someone rightclicks on a block that is instanceof Lockable?
PlayerInteractEvent?
yes
oki
Class - xTagEvent: ```java
@EventHandler
public void onItemPickup(EntityPickupItemEvent event) {
if (!(tagItem.isTagItem(event.getItem().getItemStack()))) return;
<more code here>
}
Class - tagItem: ```java
public boolean isTagItem(ItemStack itemStack) {
try {
boolean result = (itemStack.equals(Material.NAME_TAG) && itemStack.getEnchantments().containsKey(Enchantment.MENDING) && itemStack.getItemMeta().getDisplayName().contains("ยงcTag!"));
return result;
} catch (Exception e) {
return false;
}
}
Error: (attached)
?paste
good stuff
line 46
if (!(tagItem.isTagItem(event.getItem().getItemStack()))) return;
also oh my god that is the worst way to check for a custom item dude
holy fucking shit
How should I check then? ๐
I'd say it works but it doesn't sooo
lmao
how do i make a const or switch with a ChatColor
If on older ver
pog
NBTApi
dont use older versions. simple.
oh ok
supposedly nbtapi still has some advantages over pdc
namely not having to clone the itemmeta for every check
but that isn't really worth using an external library usually
I can run it async, so time isn't that bad tbh
what about blocks
I'll figure out a way ๐
holding persistent data in blocks
tile entities are also persistent data holders
inb4 it checks every block every tick
thanks
if you're working with tile entities, use the PDC
you wish it checked every tick
as it doesn't involve listening to 300 events
but it does break lol
and doesn't explode when other plugins delete or move the blocks
just randomly desyncs from the db file
is the db file a .txt
๐คก
literally impossible to tell
we don't know where it's from
presumably the method you're getting it with is nullable
ah nvm its cause serverSection might be null
sorry I was getting frustrated with the javadoc cause I didnt think about the ConfigurationSection object
hellp
i want to start developing minecraft plugins with IntelliJ Idea, what year and version do you reccomend to do a bedwars plugin?
on my c i have 2020.3.2
xdd
the latest IntelliJ version should do great
those unverified people in this channel, can never trust them smh
i dont think it matters
because i have installed the minecraft development on intellij
i have to install the 2021 for a great work?
I mean no, but updating is never a bad idea
depends on the plugin requirements
2021 community edition i download?
sure
yes
i use an IJ IDEA pl named minecraft development, it has some mc versions witha premade code an pl.yml made
that plugin works on the latest version of intellij
ok
can i do a backport of the pl? because i want them from 1.8 to 1.12
if i start doing 1.12 is possible?
your IDE has nothing to do with how you code a plugin
yeah i know, i was talking about coding
oh
if i do the required files i can do?
How can I open a "Book GUI" for a player?
sure you can create a plugin that runs on all servers between 1.8 and 1.12
can you link me a site with all the bukkit api?
to help me in coding
or a link to the most important mc plugin codes
like private void
or cmd
ok
package index
and are the same with paper?
Yes.
because i do a paper-spigot pl
gl
for performance because i do a very high and heavy plugin
that sounds great!
i take all the best features of all the bw plugins that exists on spigot and i create an unique custom pl
awesome
how can I get entities in a radius of a location? I thought there was something like Location#getNearbyEntities(radius) but I can't seem to find it
World#.getNearbyEntities();
that is paper only api. There is https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/World.html#getNearbyEntities(org.bukkit.Location,double,double,double)
declaration: package: org.bukkit, interface: World
if i need help/advices of coding can i ask you?
no
ok
Keep in mind this is related to Bungee and Spigot only, nothing else.
i finis installing the 2021 and i start work
i have a lot of work to do
i start by thinking and organize the features (12 features ca.)
questions are not allowed.
ok
Ask on
Are you using maven, gradle or built in compiler
I know what that is
how do i generate a vanilla world using worldcreator
do i just not set the generator?
that plugin usually uses maven btw
and yes, not setting a generator defaults to vanilla generation
anyone?
Screenshot of code 
https://paste.md-5.net/uxikuwufav.java here you go man
code & error: https://paste.md-5.net/setugicabi.coffeescript
Issue is cast whenever any item is picked up, running the createitem works perfectly and gives an item.
Anyone has any advice?
Console error refers to if (!(tagItem.isTagItem(event.getItem().getItemStack()))) return;
please make different pastes
i don't know what your line 46 is because of how you made it
updated message
line 46 is if (!(tagItem.isTagItem(event.getItem().getItemStack()))) return;
check if item != null
How can Item be null?
idk ._.
it's cast when an item is picked up
mostly of the time theese are the common problems
it gives you nullpointer so idk ๐
...
The issue most likely is in the persistentdatacontainer
but I don't really see it myself...
getItem is probably annotated with @urban grotto and
I suppose it's EntityPickupItemEvent
meaning it will never be null
cause it needs an item to do the event.
why ?
poor man ๐
p
Ohh
he was the tag
Well he could just change his name
smh
yeah$
anyways
it's kinda annoying that I can't seem to save it
I mean, i can just check the name and call it a day
but I do wish to use this method, it seems... best practice
how would i delete a world
I think java must change his annotion name for that
why did u name urself after an annotation
regardless.
Hi is there a way to avoid player which placeBlockEvent is canceled but with a macro can still pose a block and get up on it ?
is it only client side ?
Sorry what
Je suis un chat dans la citรฉ des รฉlรฉments
Ma boutique :โบ https://www.moteefe.com/store/aypierre
Participez au giveaway de jeu chaque mois ici :โบ https://www.instant-gaming.com/fr/l/ayepierre?igr=aypierre
โบ Intro par Tib : http://youtube.com/tib8tib
โบ Montage par okamedia : https://www.okamedia.fr/
Accรฉdez ร toutes mes rediffs de stream :โบ ...
what a gay language
not really
you mean when you place a block and then jump on top of it
you need an anticheat plugin for that
player velocity is entirely clientside
the player can start flying if the player wants to fly
well
the vanilla server does some super rudimentary and shitty checks to try and prevent it but they're notoriously bad
How can you get the refrenced jar files from a jar file. Basically you know how you add the spigot server inside your plugin right. I need to get that from an existing jar file. I want to see what It is because I want to make some changes to multiverse and maybe push it to their repo.
the spigot server does not go in a plugin
I'm still having the issue where I'm clearing a person's inventory & then teleporting them to a diff world, not sure if that's related, but in this case 1 of their previous items persists
ok thx for the info
the plugin references the spigot server
the spigot server is provided by the runtime
someone can give me a link of how to add placeholders on mine plugin
the jar itself does not contain information about what "jars" the code in it references
(with papi adding support)
it only contains information about what classes are referenced
these classes could come from any jar
what you are looking for is a maven/gradle project where in the project file, pom.xml for maven, the involved dependencies and their artifact information is listed
World active = Objects.requireNonNull(Bukkit.getWorld("world_active"));
Bukkit.unloadWorld(active, false);
try {
FileUtils.deleteDirectory(active.getWorldFolder());
} catch (IOException e) {
e.printStackTrace();
}```
why does this not do the thing
delete world
Huh. But the api
Where else will you import the events and listiners from
you wanna know what dependencies multiverse has ?
Yes
either you attempt to go by package names inside the jar or (the more reasonable way) check out their source code?
Wait so do I just need the core plugins in my server plugins folder
or do I need to add it. Eclipse gives you an option to add externals jar for importing stuff from it
what
if you are trying to work on multiverse you clone their repo
I don't know what your goal is here
they seem extremely confused
How am I supposed to test it?
you build it
Ok waiting 2 ticks after the event to clear their inventory seems to have fixed the ghost item.
just now there is already source code
But will I need to add the dependinces inside my plugin
yes
yes, you will use maven to add them
eclipse maven should also automatically import then
and by use I mean maven will read multiverse's pom.xml and do it automatically
How do I check If maven is on my eclipse project
oh boy
like i explained at first
or is it added by default?
the information isn't in the jar
oh boy
it's in the project
ok thanks
World active = Objects.requireNonNull(Bukkit.getWorld("world_active"));
Bukkit.unloadWorld(active, false);
try {
FileUtils.deleteDirectory(active.getWorldFolder());
} catch (IOException e) {
e.printStackTrace();
}```
why isnt that deleting the world
are you getting an exception
sweet
cannot save
keep in mind that the main world cannot be unloaded
it also takes a while for chunk io and shit to be flushed to disk
there is no good api way of figuring out when the unload is actually done
which is a big issue for autosave/backup plugins
๐ฆ
is there a difference between private final int a; and final private int a;
would this work
World active = Objects.requireNonNull(Bukkit.getWorld("world_active"));
Bukkit.unloadWorld(active, false);
Bukkit.getScheduler().scheduleSyncDelayedTask(plugin, () -> {
try {
FileUtils.deleteDirectory(active.getWorldFolder());
} catch (IOException e) {
e.printStackTrace();
}
}, 100L);```
if the active world
isnt that big
and nobody is on it
ยฏ_(ใ)_/ยฏ
afaik, yes
How can I store an entire itemstack in a bytearray, including name, enchants, lore, flags, attributes, nbt, etc etc
Itemstack#serialize()
I dont know if that includes the custom nbt and persistent data and all
also it returns a Map<String, Object> which isnt exactly easily made into bytes
you basically pass it into a BukkitObjectOutputStream
you can also go full NMS
and use nms.ItemStack#save(NBTTagCompound)
this is from code that I wrote a long time ago
public static byte[] toByteArray(ItemStack item) {
try {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
BukkitObjectOutputStream bout = new BukkitObjectOutputStream(baos);
bout.writeObject(item);
bout.flush();
return baos.toByteArray();
} catch (IOException e) {
return new byte[0];
}
}
public static ItemStack fromByteArray(byte[] arr) {
try {
ByteArrayInputStream bais = new ByteArrayInputStream(arr);
BukkitObjectInputStream bois = new BukkitObjectInputStream(bais);
return (ItemStack) bois.readObject();
} catch (IOException | ClassNotFoundException e) {
return new ItemStack(Material.AIR, 1);
}
}
that would serialize it all? ๐ค
if it doesn't that should be reported afaik
the yml representation of an itemstack is supposed to fully represent it
thank you ๐ I'll test it out
if you were using paper you could just use ItemStack::serializeAsBytes
how do i make an item have the enchantment glint without having enchantments. you can do this with nbt by having an empty enchantment list. How should i do this in spigot? you cant addEnchantment as null
simplest way I think would be to add some unrelated enchantment and then add the hide enchantments flag
i don't think the api lets you create an empty enchant list
the yml representation of an itemstack has issues with version upgrades
don't be surprised if a serialized itemstack suddenly blows up after updating
i don't know whether the bukkit output stream uses a different serializer or if it has the same issues
I believe it uses the same stuff
Yeah the paper method is neat ๐ญ
someone recreate on upstream pls
it's just like 10 lines or something anyway, would be an easy pr
it piggybacks off of nms serialization
question is what licence that patch is under xD
just change some of the var names
๐ ๐ฎ
no like seriously you can't license the concept of using nms to serialize itemstacks
Yeah xD
and there aren't very many ways of going about doing it
I mean if it is MIT you could also just casually take it
so i have a custom world for the game
called world_active
and i want people who come back from the nether
go to that world
instead of the normal "world"
there are various portal events
what one would i listen to
ok how do i change where the portal is created
and where they teleport to
i'm not seeing any setters for the target world on any of the events
there is a Vector you can set on entityexitportal, but that doesn't take a world
might want to look into how multiverse-portals does it
getFrom, getTo, setTo
i have a new interesting problem
Falling Blocks break easily
really easily
I'm trying to figure out how to make the blocks that spawn from the edges of things not break near-instantly on being created
After I gat nearby entities with world.getNearbyEntities();, I got the collection. But How would I run a multiply command like a event function
what
@wraith rapids Talking to me or him?
What do you mean
I have been working with falling blocks a lot recently
To make them not break you have to get into packets cause they break no matter what
Basically, when I create a fall block that is on a hill, it often breaks.
Hello, i spawn slime and armorstand with packet wrapper. Armorstand is a passenger of slime, and slime is passenger of player. I send the packets to all players, and owenr of armorstand/slime sees that entities as passengers, but other players sees armorstand riding on slime, but not on the player. Do you know why? This is element of code, which send packets to players:
for (Player players : Bukkit.getOnlinePlayers()) {
slimePacket.sendPacket(players);
armorStandPacket.sendPacket(players);
slimeMetadata.sendPacket(players);
armorStandMetadata.sendPacket(players);
slimeMount.sendPacket(players);
playerMount.sendPacket(players);
}```
@opal juniper let me send you a video
Ok
Well considering we donโt know anything else, code related, we probs canโt help
I created a Itemstack.
how would I add to a players inv
player.getinv.additem() ect or something else
it's saying it's null in the server console
player.getinv.additem() etc
nvm got it in the additem(class.item)
๐
carry all enchantments from one item to another
i have this
ItemMeta newMeta = stack.getItemMeta();
for (Enchantment enchantment : meta.getEnchants().keySet()) {
newMeta.addEnchant(enchantment, meta.getEnchants().get(enchantment).intValue(), false);
}
stack.setItemMeta(newMeta);
only 1 enchantment gets put on
?
? is not a very good question
im using getEnchants tho?
yes, and the method you were linked to was getEnchantments
inb4 the item only has 1 enchant to begin with
imagine if bukkit actually supported datapack shit
Can you adjust the force of which a spawned particle moves as my cloud particle looks like this
im not sure how im going to detect if an enchantment is vanilla or not
im resisting the urge to throw everything in a try catch
check if bukkit supports it
hmm there doesn't seem to be an api for the plugin
which plugin are we talking about
goldenEnchants
is it shit
i need a not shit custom enchant plugin
i don't think I've tested or heard of that one
world.spawnParticle(
particle,
randomPlayerLocationX + publicCircleX,
randomPlayerLocationY, randomPlayerLocationZ + publicCircleZ,
1, 0, 0, 0, 1);
world.spawnParticle(
particle,
randomPlayerLocationX + publicCircleX,
randomPlayerLocationY-10, randomPlayerLocationZ + publicCircleZ,
1, 0, 0, 0, 1);
what are your standards
quite high
it's not like i expect anyone to help with that
well enchantment table support broke so its pretty bad
is it open source
i don't particularly mind the enchanting table integration not working, mostly concerned about performance and balance
variety is a plus as well
balance is okay
there are some super op ones like divine touch where you can mine a spawner and keep it
but its really rare
also some make zero sense
my server already has tools for that so i suppose that should be fine by itself
had to rewrite spawner mechanics entirely with a plugin so as to not kill the server
ah
so far the plugin seems worth trying out
i'll lurk around the source for a bit and see if I can find any red flags
its definitely one of the better ones
strange that i haven't heard of it
ig i don't really keep an eye on plugins
but i don't remember seeing anyone using it
for context, im running a small smp with a few friends and im making some plugins to make the experience better
i can probably wrap the whole thing in a trycatch and just creative in the enchants when they complain
this will only affect 1 item one time
it works normally
the enchants are probably getting copied
just the lore lines that display them aren't
Yeah i know its weird
it looks like the plugin uses the actual enchantment storage on the items to store the enchantments
that is, the golden enchants are included in meta.getEnchants()
and can be differentiated via instanceof GoldenEnchant
you'd probably need to add this plugin as a dependency and invoke its methods and logic if you wanted to copy over the enchants properly
i'll have to implement that in slimefun autoenchanter code so fuck me i guess
fuck slimefun
fucking worst plugin ever
HNG
oh thanks wow
i also realized there was a super simple solution i was overlooking where i wouldn't have to to that at all but it will be useful later
the passive effects code could be improved a little performance wise but it should be fine
and by little i mean a shit ton
other than that it looks very good
source code is properly commented and the project structure looks pretty neat
also, can anyone give me advice on how to handle extra custom crafting (requiring ItemStacks in recipies instead of just Materials)
use ExactChoice instead of MaterialChoice
when defining the recipe
ohhh
okay thanks
i was worried i would need to completely overhaul the crafting menu
Hey so was wondering how i would make a plugin function as both the a Bungeecord Messenger (sends out messages: bungee -> spigot) and like a spigot receiver
obviously its just checking a config.yml value to determine which one it would be but
wait with MaterialChoice am i allowed to say i want a certain amount of an item?
i mean exactchoice
you wouldn't check a config value
you would check whether your plugin was initialized through the bukkit main class or the bungee main class
no, crafting doesn't support stack sizes
oh okay
oh
there is zero legitimate reason for this dependency to be a standalone plugin
there is already someone complaining about two of this guy's plugins requiring 2 different versions of this dependency in the reviews
none of his projects use a build system or if they do, the configuration is not released along with the source
i'll fork and unfuck it i guess
anyone know why this https://prnt.sc/13a98pd wouldnt actually change my damage value to 0? executing the damage has low event priority so shouldnt it execute after this?
low executes first
Please, ALWAYS replace the engine .jar from every plugin update.
fucking learn to shade
i hate these people
i'll review bomb this shit to the lowest hell
you literally ship the fucking dependency jar in a zip with your actual plugin
okay i have this weird issue this if(held_item_data.has(new NamespacedKey(Exstinctio_weapons.getPlugin(), "Sky"), PersistentDataType.STRING)){random code} doesnt work and its never true will this works even though the item has that data type that has that value. if(held_item_data.has(new NamespacedKey(Exstinctio_weapons.getPlugin(), "Blitz"), PersistentDataType.STRING)){//random code}. both items are being check in the if statement and the 1st doesnt works and idk why. I be holding the item that has that key in it. The same item in my hand has that key because the item has when its created using a command in this code ``` data.set(new NamespacedKey(Exstinctio_weapons.getPlugin(),"Sky"), PersistentDataType.STRING,"Sky");
at least it's open source so I can just take it and make it not shit
but fuck, I actually thought for a moment that I had managed to find something that wasn't fucking trash
ok i have ab iten called skyblaster and when its created it has that data type. the if statement checks if the item has that PersistentDataType with a name
and its never true for some reason even though that item has it when its created
Is org.sqlite relocated in the Spigot/CraftBukkit server?
no
My plugin uses the latest version of sqlite and it's throwing
java.lang.AbstractMethodError: Receiver class org.sqlite.Conn does not define or inherit an implementation
of the resolved method 'abstract boolean isValid(int)' of interface java.sql.Connection.
which makes me think there's a conflict of versions
And I can't relocate because the binary for the library contains strings that reference the original org.sqlite package
Is that the reason why?
yes
Is there any other way?
you can try using the new libraries functionality in 1.16.5
but spigot packages a very recent version of sqlite anyway
why do you specifically need this version?
I don't, I just keep all of my libraries up to date.
stop packaging sqlite and forget about it then
Can you elaborate?
Actually, I am packaging it because Spigot 1.7 doesn't contain it I believe
spigot 1.7 does
I ran into a 1.7 specific error with CraftBukkit
but also bloody hell, that's like 7 years old
1.17 you mean
no they mean 1.7
remove versions less than half the current
well there's nothing you can do for 1.7 then
if you want 7 year old things to work, then you need to code against 7 year old libraries
including sqlite
mfw pretty soon people who weren't born when 1.7 was released are gonna be in this discord
My first version was 1.5...the days
well, If I can shade and relocate java.sql.Driver then I can package it...
maybe I'll do that
Oh haha I see your comment on the official repo... https://github.com/xerial/sqlite-jdbc/issues/145#issuecomment-270813475
Thanks i just got this lmao im not really familiar with spigot or bungee or java
i still do need the config.yml so the spigot plugin knows wether or not the plugin is gonna be standalone or using message channels
what the fuck
this library plugin shit actually contains a package org.jetbrains.annotations
with NotNull, Nullable and Range in it
literally what the fuck on this earth is this guy doing
@sullen marlin I checked spigot's pom, and the version there is identical to the one I am using. Do you know of any reason why it would throw
java.lang.AbstractMethodError: Receiver class org.sqlite.Conn does not define or inherit an implementation
of the resolved method 'abstract boolean isValid(int)' of interface java.sql.Connection.
```?
Perhaps it's a different version in craftbukkit/1.8? (because I am testing on 1.8)
Does spigot detect pom.xml
at the directory
because the dependinces are not installing
pom.xml isn't included in your binary
After I gat nearby entities with world.getNearbyEntities();, I got the collection. But How would I run a multiply command like a event function
What does that mean
stop shading sqlite in your jar
you cant do it, its just not possible @eternal grotto
so you want to multiply entities in a radius?
I've seen this being used. Not sure how appending resources affects the jar since I don't use maven
<transformer implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
<resource>META-INF/services/java.sql.Driver</resource>
</transformer>
So I got the collection from .getNearbyEntities so how would I use each craft entity and find the location
Wait so how can I get the dependincies to work?
dependencies for what?
spigot?
.forEach(e -> e.getLocation())
For what Im using
and what is it that you are using?
I am trying to use multiverse with my plugin
Well I want to fix a issue that has not been fixed for a long time with multiverse nether portals
The import com.onarandombox.MultiverseCore cannot be resolved
The import com.onarandombox.MultiverseCore cannot be resolved
MVPlugin cannot be resolved to a type
MultiverseCore cannot be resolved to a type
CommandHandler cannot be resolved to a type
MultiverseCore cannot be resolved to a type
MultiverseCore cannot be resolved to a type
MultiverseCore cannot be resolved to a type
MultiverseCore cannot be resolved to a type
MultiverseCore cannot be resolved to a type
MultiverseCore cannot be resolved to a type
MultiverseCore cannot be resolved to a type
CommandHandler cannot be resolved to a type
MultiverseCore cannot be resolved to a type
Command cannot be resolved to a type
CommandHandler cannot be resolved to a type
Command cannot be resolved to a type
CommandHandler cannot be resolved to a type
Command cannot be resolved to a type
Command cannot be resolved to a type
HelpCommand cannot be resolved to a type
CommandHandler cannot be resolved to a type
MultiversePortals cannot be resolved to a type
MultiversePortals cannot be resolved to a type
MultiverseCore cannot be resolved to a type
MultiverseCore cannot be resolved to a type
MultiverseCore cannot be resolved to a type
MultiverseCore cannot be resolved to a type
at com.onarandombox.MultiverseNetherPortals.MultiverseNetherPortals.<init>(MultiverseNetherPortals.java:7) ~[?:?]
at jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) ~[?:?]
at jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source) ~[?:?]
at jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source) ~[?:?]
at java.lang.reflect.Constructor.newInstance(Unknown Source) ~[?:?]
at java.lang.Class.newInstance(Unknown Source) ~[?:?]
at org.bukkit.plugin.java.PluginClassLoader.<init>(PluginClassLoader.java:76) ~[spigot-1.16.5.jar:2991-Spigot-018b9a0-f3f3094]
at org.bukkit.plugin.java.JavaPluginLoader.loadPlugin(JavaPluginLoader.java:135) ~[spigot-1.16.5.jar:2991-Spigot-018b9a0-f3f3094]
... 7 more```
If you are depending on the api using compileOnly/whatever the equiv in your pom, then it should all work
do you have MultiverseCore in your plugins fodler
Do I need it there?
yes
Yes. Also, that's not a valid stacktrace
wydm?
I cant upload an image
?paste
image
paste
what is the image of?
if its anything to do with development you can paste it
Not that...
Ok. So If i have multiverse core in my plugins folder it will work?
well yes its a dependency
so in most cases if you're depending on a plugins api, you need the plugin aswell
the api is only the interface, the plugin still needs to function
@sullen marlin What about an isolated classloader?
Is the only point for a reference library in eclipse is to stop potential errors?
Pretty much. Autocomplete, highlighting, and the #2 function of a compiler, tell you when you did something wrong.
I keep on getting this error:
at org.bukkit.craftbukkit.v1_16_R3.CraftServer.loadPlugins(CraftServer.java:383) ~[spigot-1.16.5.jar:2991-Spigot-018b9a0-f3f3094]
at net.minecraft.server.v1_16_R3.DedicatedServer.init(DedicatedServer.java:185) ~[spigot-1.16.5.jar:2991-Spigot-018b9a0-f3f3094]
at net.minecraft.server.v1_16_R3.MinecraftServer.w(MinecraftServer.java:809) ~[spigot-1.16.5.jar:2991-Spigot-018b9a0-f3f3094]
at net.minecraft.server.v1_16_R3.MinecraftServer.lambda$0(MinecraftServer.java:164) ~[spigot-1.16.5.jar:2991-Spigot-018b9a0-f3f3094]
at java.lang.Thread.run(Unknown Source) [?:?]
Caused by: java.lang.Error: Unresolved compilation problems:
The import com.onarandombox.MultiversePortals cannot be resolved
The import com.onarandombox.MultiverseCore cannot be resolved
The import com.onarandombox.commandhandler cannot be resolved
The import com.onarandombox.commandhandler cannot be resolved
The import com.onarandombox.MultiverseCore cannot be resolved
The import com.onarandombox.MultiverseCore cannot be resolved
MVPlugin cannot be resolved to a type
MultiverseCore cannot be resolved to a type
CommandHandler cannot be resolved to a type
MultiverseCore cannot be resolved to a type
MultiverseCore cannot be resolved to a type
MultiverseCore cannot be resolved to a type
MultiverseCore cannot be resolved to a type
MultiverseCore cannot be resolved to a type
MultiverseCore cannot be resolved to a type
CommandHandler cannot be resolved to a type
MultiverseCore cannot be resolved to a type
Command cannot be resolved to a type
CommandHandler cannot be resolved to a type
Command cannot be resolved to a type
CommandHandler cannot be resolved to a type
Command cannot be resolved to a type
Command cannot be resolved to a type
CommandHandler cannot be resolved to a type
HelpCommand cannot be resolved to a type
CommandHandler cannot be resolved to a type
MultiversePortals cannot be resolved to a type
MultiversePortals cannot be resolved to a type
MultiverseCore cannot be resolved to a type
MultiverseCore cannot be resolved to a type
MultiverseCore cannot be resolved to a type
MultiverseCore cannot be resolved to a type
at com.onarandombox.MultiverseNetherPortals.MultiverseNetherPortals.<init>(MultiverseNetherPortals.java:7) ~[?:?]
at jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) ~[?:?]
at jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source) ~[?:?]
at jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source) ~[?:?]
at java.lang.reflect.Constructor.newInstance(Unknown Source) ~[?:?]
at java.lang.Class.newInstance(Unknown Source) ~[?:?]
at org.bukkit.plugin.java.PluginClassLoader.<init>(PluginClassLoader.java:76) ~[spigot-1.16.5.jar:2991-Spigot-018b9a0-f3f3094]
at org.bukkit.plugin.java.JavaPluginLoader.loadPlugin(JavaPluginLoader.java:135) ~[spigot-1.16.5.jar:2991-Spigot-018b9a0-f3f3094]
... 7 more```
How do I fix it?
Caused by: java.lang.Error: Unresolved compilation problems:
your plugin isnt compiled correctly
fix all the errors in your ide and do a clean compile
ah so like corrupted?
How to I kill a Craft Entity without it dropping anything?
Lol. I got it to work.
if (file.getName().contains("sqlite")) {
ADD_URL_METHOD.invoke(isolatedClassLoader, file.toURI().toURL());
} else {
ADD_URL_METHOD.invoke(originalClassLoader, file.toURI().toURL());
}
Entity#remove
though you could also clear the drops in EntityDeathEvent after doing Entity#kill
if you need the death animation
this plugin is worse than slimefun
it is an absolute crime that this hack of a fuck is selling plugins
Is there anyway to make tab-complete of command auto complete the text? For example: if I were to type up it would auto-complete as update
who
this guy who wrote goldencrates and goldenenchants
oh lol
literally the worst shit i have ever seen
nope
well keep it that way
they don't use any build system
their plugins all depend on some fucking horrible core library
that isn't a fucking library
plugin.lang().Command_Give_Usage.getMsg();
but rather an actual standalone plugin
meaning they can't shade it
meaning you need to update it every time you update one of their plugins
and meaning that you are outright fucked if two of your plugins need a different version of it
i've spent like the last hour trying to iron out the bullshit and mavenize and unfuck the golden enchants project
the plugin looks nice but I want to be able to work with it, which looks to be a total impossibility
i guess i'll have to write my own enchants plugin after all
lol
eh you could probably find it anyways
well it can't possibly be any worse than this
Is that a challenge
Youโve heard of maven, gradle, and even ant
get ready for nexengine
But what about building it by compiling each class one at a time and manually shoving them into a jar
there is literally a fucking org.jetbrains.annotations package in nexengine
with NotNull Nullable and Range annotations in it
i have absolutely no fucking clue what the fuck
look at this shit
did they just copy it
yes
why depend on jetbrains annotations when you can copy jetbrains annotations into your project
just copy the jdk in your project god damn
Hey so im getting Cannot resolve com.vexsoftware:nuvotifier-universal:2.6.0 error when trying to use nuvotifier as a dependency is it possible im doing something wrong or maybe the endpoint for the dependency is broken ?
Hey how can I import another plugin inside mine? Like I am working on fixes to push to the multiverse nether portals repo and I get this error:
latest version is 2.7.2, try that?
org.bukkit.plugin.InvalidPluginException: java.lang.NoClassDefFoundError: com/onarandombox/MultiverseCore/api/MVPlugin
at org.bukkit.plugin.java.JavaPluginLoader.loadPlugin(JavaPluginLoader.java:139) ~[spigot-1.16.5.jar:2991-Spigot-018b9a0-f3f3094]
at org.bukkit.plugin.SimplePluginManager.loadPlugin(SimplePluginManager.java:394) ~[spigot-1.16.5.jar:2991-Spigot-018b9a0-f3f3094]
at org.bukkit.plugin.SimplePluginManager.loadPlugins(SimplePluginManager.java:301) ~[spigot-1.16.5.jar:2991-Spigot-018b9a0-f3f3094]
at org.bukkit.craftbukkit.v1_16_R3.CraftServer.loadPlugins(CraftServer.java:383) ~[spigot-1.16.5.jar:2991-Spigot-018b9a0-f3f3094]
at net.minecraft.server.v1_16_R3.DedicatedServer.init(DedicatedServer.java:185) ~[spigot-1.16.5.jar:2991-Spigot-018b9a0-f3f3094]
at net.minecraft.server.v1_16_R3.MinecraftServer.w(MinecraftServer.java:809) ~[spigot-1.16.5.jar:2991-Spigot-018b9a0-f3f3094]
at net.minecraft.server.v1_16_R3.MinecraftServer.lambda$0(MinecraftServer.java:164) ~[spigot-1.16.5.jar:2991-Spigot-018b9a0-f3f3094]
at java.lang.Thread.run(Unknown Source) [?:?]
Caused by: java.lang.NoClassDefFoundError: com/onarandombox/MultiverseCore/api/MVPlugin
at java.lang.ClassLoader.defineClass1(Native Method) ~[?:?]
at java.lang.ClassLoader.defineClass(Unknown Source) ~[?:?]
at java.security.SecureClassLoader.defineClass(Unknown Source) ~[?:?]
at org.bukkit.plugin.java.PluginClassLoader.findClass(PluginClassLoader.java:163) ~[spigot-1.16.5.jar:2991-Spigot-018b9a0-f3f3094]
at org.bukkit.plugin.java.PluginClassLoader.findClass(PluginClassLoader.java:96) ~[spigot-1.16.5.jar:2991-Spigot-018b9a0-f3f3094]
at java.lang.ClassLoader.loadClass(Unknown Source) ~[?:?]
at java.lang.ClassLoader.loadClass(Unknown Source) ~[?:?]
at java.lang.Class.forName0(Native Method) ~[?:?]
... 7 more```
do you have multiverse core on the test server?
Could not find artifact com.vexsoftware:nuvotifier-universal:pom:2.7.2 in jitpack (https://jitpack.io)
yes
also getting this when i try to compile ๐ [WARNING] The POM for com.vexsoftware:nuvotifier-universal:jar:2.6.0 is missing, no dependency information available
bro wait patiently no one here is paid to help๐
I thought my message was drowned out. I am not forcing anyone.
hey
your message is, like, drowning out everything else lmao
xD
why is setCancelled(true) in projectileHitEvent not working?
It's declared in the javadoc
show the code
Is that for me?
?
but also it might be that it's getting called multiple times?
Wait a min
nvm
probably is, but is multiverse core in the depend?
How to upload images :/
In the pom.xml or inside the jar?
plugin yml
Oh right. I will quickly do that
why can't i upload images?
i told you six minutes ago.
The error is The method isCancelled() is undefined for the type ProjectileHitEvent
Oh sorry
bet you're not using 1.16
and all the other event options show up?
anything else?
1.16.5 spigot api or spigot?
ProjectileHitEvent may have only recently implemented Cancellable
you can re-run buildtools
otherwise the maven repo is here https://bukkit.fandom.com/wiki/Plugin_Tutorial_(Eclipse)
?paste your pom.xml
nvm
Something tells me they donโt have one
I found my problem
Sorry
it's 1. illegal and 2. may be malicious
My bad
well if it works there are no problems
doesn't*
you mind trying to use nuvotifier as a dependency yourself
I have no idea what I did wrong lol
verify account
So I get this error Caused by: java.lang.ClassNotFoundException: com.onarandombox.MultiverseNetherPortals.MultiverseNetherPortals but the path is the same. I just got this error now. Proof:
Plugin.yml:
main: com.onarandombox.MultiverseNetherPortals.MultiverseNetherPortals
Just to clarify It worked alright a second ago
I dont get it
isnt MultiverseNetherPortals already a plugin
If it is, what are you doing? If it isn't, why are you stealing their package name?
Oh no. I am making some fixes that I will push to their repo once I finish testing it
Fixes about linking portals
I own no part of multiverse nether portals
@sullen marlin
what did you change that their compiled version works and yours doesn't? lol
they use maven, you should too
Idk what happened. I decompiled there plugin then recompiled it on eclipes
I copied the pom.xml but I think the server ignores it.
Do you want me to send the jar?
Well I guess it does not matter anymore? I mean I have the same files
I try use git
I downloaded it as a zip and it does not look much different
full plugin.yml:
name: multiverseNPpatch
version: 1.0
decription: patch
api-version: 1.16
depend: [Multiverse-Core, Multiverse-Portals]```
compilers arent exactly translators, you can go from java to machine code and back and get the same result as what you put in
im having a config file like
Player 1:
"playername"
"playerip"
PLayer 2:
"player2name"
"player2ip"
How do i make it compare the name of the joining player with the name in the config file, then the ip of the joining player with the ip in the config file
Yeah but not always
If the code is on GitHub you should just learn git
Or just how to click a few buttons like the page says
Or if you want you can even download the code in a zip
guys
is there any way to make custom recipes with enchanted/lored/displayname-changed items?
yes
i want to put enchanted items ingredient
is there any examples of initializing RecipeChoice one?
exactly the same as Material but new RecipeChoice.ExactChoice(item)
thx
I looked in the api docs but I dont know how to log something with a plugin. Like you run a command and it will respond with "hello world" in the chat
I dont see anything about sending a message in the chat
sender.sendMessage
Player#sendMessage
Bukkit#broadcastMessage
Both easily find-able if you bother going through the available methods & javadocs m8
Actually, it's CommandSender#sendMessage
uHm AcTuallLy
I am using 1.16 and import org.bukkit.event.server does not work because apprently its not a thing
declaration: package: org.bukkit.event.server
bruh
what?
you need to import the specific class too @topaz atlas
Might i suggest a java tutorial first instead of jumping head first into spigot development? ๐ค
Huh. I thought It did not exist and I had the wrong version
server is a package, not a class you can use.
https://www.youtube.com/watch?v=Hl-zzrqQoSE&list=PLFE2CE09D83EE3E28 Follow this @topaz atlas
Join our community below for all the latest videos and tutorials!
Website - https://thenewboston.com/
Discord - https://discord.gg/thenewboston
GitHub - https://github.com/thenewboston-developers
Reddit - https://www.reddit.com/r/thenewboston/
LinkedIn - https://www.linkedin.com/company/thenewbostoncoin/
Facebook - https://www.facebook.com/then...
you need it
badly
I am good
says the one who couldn't tell apart a package & class ๐
well
that tutorial covers installation
i imagine Spider might've already installed java
Hmmm
wouldn't hurt to go over it though regardless, just to make sure you didn't make any mistakes or oversights
my brain forgets from time to time
There's more than that, it's a proper playlist
ah didn't see it was part of a playlist, yeah that would help perhaps
Full beginner playlist :p
https://www.youtube.com/watch?v=vW53w7me4AE&list=PL27BCE863B6A864E3 nice Intermediate playlist too
Join our community below for all the latest videos and tutorials!
Website - https://thenewboston.com/
Discord - https://discord.gg/thenewboston
GitHub - https://github.com/thenewboston-developers
Reddit - https://www.reddit.com/r/thenewboston/
LinkedIn - https://www.linkedin.com/company/thenewbostoncoin/
Facebook - https://www.facebook.com/then...
You donโt just forget how to tell apart the two
You either know or donโt know
Class.forName("org.bukkit.TravelAgent");
event.getPortalTravelAgent().setCanCreatePortal(true);
``` Error: ```
The method getPortalTravelAgent() is undefined for the type EntityPortalEvent```
That does not mean I dont know anything about java
Anyways
But it does mean you have a lot to learn >.<
I guess
The method doesnโt exist
It tells you this
for multiverse it does
What spigot version are you on?
1.16
Canโt help ya there
What should I do?
Why are you using reflection to find classes?
Bukkit does not expose teh TravelAgent
try using setAccessible.
Class.forName("org.bukkit.TravelAgent"); wtf is this even meant to do
and honestly it seems like you dont know java
if my config file like this:
Player 1:
name:
- "PLAYER1NAME"
ip:
- "234.234.234.234"
PLayer 2:
name:
- "PLAYER2NAME"
ip:
- "123.123.123.123"
and my code are
@EventHandler
public void playerjoin(PlayerJoinEvent event){
String namepj = event.getPlayer().getName();
String ippj = event.getPlayer().getAddress().getAddress().getHostAddress();
if (getConfig().getString("Player 1", "name") == namepj){
if (getConfig().getString("Player 1", "ip")== ippj){
event.getPlayer().sendMessage(ChatColor.RED + "Welcome Playername");
}
else{
ConsoleCommandSender console = Bukkit.getServer().getConsoleSender();
Bukkit.dispatchCommand(Bukkit.getConsoleSender(), "banip Playername");
}
}
if (getConfig().getString("Player 2","name") == namepj){
if(getConfig().getString("Player 2", "ip") == ippj){
event.getPlayer().sendMessage(ChatColor.RED + "Welcome Playername");
}
else{
ConsoleCommandSender conosle = Bukkit.getServer().getConsoleSender();
Bukkit.dispatchCommand(Bukkit.getConsoleSender(), "banip Playername");
}
}
}
will it compare the name of current player with the player in the config, then compare the current player ip with the ip in the config, and banip the player if the ip not the same?
Likely they wanted something like
var agent = (org.bukkit.TravelAgent) event.getPortalTravelAgent();
agent.setCanCreatePortal(true);
Hello! Goodmorning!
though afaik org.bukkit.TravelAgent is not exposed in the default buildpath, so idk what the hell is happening there
and no your config code wont work either because you've made name/ip a list in your yaml example
how could i fix it
Online server or offline?
Don't have it a list at all
Player 1:
name: "PLAYER1NAME"
ip: "234.234.234.234"
PLayer 2:
name: "PLAYER2NAME"
ip: "123.123.123.123"
is what I think it right
yes it is
that makes no sense
password: "password"``` while you're at it
so how could i fix it
First we need to know more abut your goals.
I'm assuming you are trying to ban players who log on with certain names from teh wrong IP
well, it is a little bit complicated without knowing the intentions as there are multiple ways of dealing this
yes
in essence you might need #getStringList and iterate over it
cracked server have many people trying to log into staff account
Well, there are a few problems with that. Names can change and so do IPs
Why not use an Auth plugin?
i want to make if the player name have different ip from the ip i want, i banip them
for somereason my friend told that it didnt work
I think your friend may be wrong
A quick search gave me https://www.spigotmc.org/resources/authmereloaded.6269/
insanity is doing the same thing over again and expecting different results
You should delete that message
I mean all I'm going off is two lines you pasted butchered of context
Two lines that anyone here who's semi competent with Java would know is never going to work.
All that Class.forName("org.bukkit.TravelAgent"); does is loading the class org/bukkit/TravelAgent or throwing an exception
But then, why would you need to play the classloader?
What he is actually referring to is Multiverse-Portals event wrapper https://github.com/Multiverse/Multiverse-Portals/blob/1b299bb122b8becb52a8b40844d7a974509011bc/src/main/java/com/onarandombox/MultiversePortals/event/MVPortalEvent.java#L107
He saw this class and thought it did all the work for him https://github.com/Multiverse/Multiverse-Portals/blob/main/src/main/java/com/onarandombox/MultiversePortals/listeners/MVPTravelAgent.java
why are they playing the classloader then, could just as well listen to ClassDefNotFoundError
They are using it to throw an exception, instead of just detecting if it exists. Not good practice to generate exceptions
Someone can link me how to setup the config yml
Thanks
Do you need bukkit to let luckyperm work
hey, I want to store an ItemStack as NBT and then restore it at some point later. Is using PersistentDataType.TAG_CONTAINER the correct way to do this?
and if so, how do I go about restoring it to an ItemStack
you can serialize an item to a Configuration
you can do that natively for things like chests, shulker boxes, etc
it has to be an arbitrary item so I'm trying to replicate the way they do it for those
but there's no general method, you'd have to make that yourself using PersistentDataContainer
hm
and bukkit supports custom PDCs right
does the default persistentDataContainer for items store enough information to restore the ItemMeta?
so I can write the NBT with:
setNBT(stack, LOADED_MAG_KEY, PersistentDataType.TAG_CONTAINER, ammoContainer.getPersistentDataContainer());
yea ammoContainer is an ItemMeta
so why not just set it in there
set what exactly?
PersistentDataContainer#set
Who understand how link particle to player? I want:
math
if im rotate
Guys, I have luckyperms and essentials but members cant break blocks or use (eat) food??
I have a GunItem (a custom item) which should be able to store an ItemMeta (ammoContainer) as NBT, so that I can load a magazine into an itemstack of type GunItem and later take it out and restore the ammoContainer as a real item
probably essentialsprotect or smthing
how can I change it?
k
as long as you can convert it to string, you can just set it in the pdc through the api
storing it is okay
my problem is with retrieving it from NBT, I need to create a new ItemStack which is formed from the gun's loaded magazine NBT key
ok now im lost
If you want to store ammo on a weapon, why not simply store an integer in the PDC?
i.e.
ItemStack Gun NBT:
-CustomItemType: "toolTestGun"
-LoadedMagazine:
--<ammoContainer serialised into NBT>
my ammo is more complex than that
I want the user to be able to load a magazine, fire a few shots, and when they take it out (i.e. to load a full one), the magazine is returned to the inventory with less ammo, and whatever other data that it had before should persist
I assume your ammo items are configurable/stored by you somewhere, yea?
yeah my ammo itemstacks are also custom items, so they have a CustomItemType (string) NBT and AmmoCount (int) nbt. All the properties of the ammunition are retrieved from the CustomItemType
So just store the ammo type as a string, retrieve your stored preset by that string and modify it to fit the new ammo count
no need to store the whole item
yeah I was thinking to do that but it may lead to problems when I want to add more per-itemstack properties to certain types of ammo
it's a bit limiting but an okay solution if restoring the full item is too much hassle
if I can get the original material from the stored PDC, I can just make a new stack and set the PDC on the new stack's meta to the stored PDC
probably less work to add more property storing pdc tags than to constantly serialize back and forth
i mean you can abuse the itemstack to string method everyone copy pastes, just not a great solution imo
nah nah itemstack serialisation is okay
it's string to itemstack which is the problem
or PDC rather than string
this is the one i meant https://gist.github.com/graywolf336/8153678
has both back and forth, still think you shouldn't do it, but ๐คทโโ๏ธ
Hello, am I not distracting you?
hm thought there would be a way to copy a PDC to a new item but that's not the case...
since you can't tell what type each key is and you also can't just do meta.setPDC() since there is no such function
guess I'll settle for storing just the info that is needed
ItemMeta is a clone
There is, you can either set the entire PDC or loop through all entries and set their values again
in what way?
I tried both but I see no set pdc method, and the looping solution needs me to know the data type of each key and that is also not provided
yea I would setItemMeta afterwards on the stack
m = stack.getItemMeta();
//update m to have proper values
stack.setItemMeta(m);
the middle part is my problem
uhh what event represents a map being used from empty map => filled map
itemMeta.getPersistentDataContainer().set(namespacedKey, PersistentDataType.TAG_CONTAINER, otherPersistentDataContainer);
no?
is there a better way to remove the hunger thing better than cancelling event everytime a player is suppose to lose hunger?
MapInitializeEvent
ty
no, but you can give the player saturation repeatedly
that way his hunger bar doesn't repeatedly go up and down
that's less effective right?
eh, debatable
public void OnHunger(EntityExhaustionEvent event)
event.iscancelled(true);
Yeah that and uh FoodLevelChangeEvent iirc
I mean
if they never get any exhause points
they don't really need to cancel foodlevelchange right
nah thats for serialising an item. I need to deserialise otherPersistentDataContainer to a new ItemStack
and also how would you cancel the mapinitializeevent if the person is holding a custom itemstack
is it possible to show the luckperms prefix next to your displayname?
Who knows how to work with particles?
If you need to cancel it, you could give PlayerInteractEvent a shot
ok then let me try
? That is not at all serialization, it simply stores one PDC on another. You can retrieve it with the same DataType and then do whatever it is you need to do with it.
yes but that is not the step I am having trouble with. The problem is that after I store this PDC on another, I want to then make a new ItemStack with the same properties as the stored PDC.
so doing the inverse of itemStack.getItemMeta().getPersistentDataContainer() is the issue
You have all namespace keys and know all data types, where's the issue
I don't know all data types
You do, you write them
not necessarily
there can also be data written by other plugins or other parts of my plugin
You have to know what data you are putting in, so you know what to get back
I'm going for a different solution now though
how can I see how much an entity was suppose to heal?
like rn EntityRegainHealthEvent's .getAmount
gives how much they would regen
the problem was that I would need to manually keep track of all the data that is being added to the ammo container, and that could be things not necessarily related to the combat system at all
so it wouldn't show anything above max health
e.g. renaming and so on
and it would be 0 if the player was full health
or anything from foreign plugins which is more of an issue
? They can't heal more than they have HP lol
So that's your original value xD
I want the value
like if I splash a potion
instant health 2 let's say
they it was suppose to health 8
but the player is full health
so when I do event.getAmount it would be 0
Yes, but I think it would make more sense to actually display the actual value and not a value that's way above what you can do anyways
It's like display the amount of damage you would've taken if not for your armor, just makes no sense
Dont worry about the intensive man, just tell me how to do it
incentive
or however you spell it
just tell me if it's possible
how not to get people to help you
sorry
But really I do have a purpose for it
is it possible to get the original amount before the limiting
it means a hard dependency is not found
<build>
<plugins>
<plugin>
<artifactId>maven-shade-plugin</artifactId>
<version>3.2.2</version>
<configuration>
</configuration>
<executions>
<execution>
<phase>deploy</phase>
<goals>
<goal>shade</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
named maven-shade-plugin
its for mongodb
