#help-development
1 messages · Page 2096 of 1
so much aggression for logging errors 😂
with your post
i dont really reccomend storing bools as strings
This is java, there is always aggression
then I should use Boolean#valueOf
yeah or create a method that converts the byte to a bool if that doesn't work
uninstall your ide
rn
i wonder what ever happened to him
no!!! I don't wanna uninstall notepad++!
I could just retrieve the string and check the returned string, use 0 and 1 in a ternary operator
can you actually do that
I'm not familiar with making pdc types
were gonna pretend i didnt fuck my grammar up that bad
yep!
unlijalling
yea
never done it myself tbh but the guides seem simple
may I ask the link for the guide
"spigot custom pdc types"
The pdc type javadocs also have an example for uuids
or just save what I like to call mini-chunks
Use JDA: https://github.com/DV8FromTheWorld/JDA/wiki/9)-Webhooks
Hey guys, sry for repost but I didn't get an answer for this before...
I have a class that extends BukkitRunnable that is intended to be run asynchronously. In the run() method I callback via a lambda.
@Override
public void run() {
final List<String> list = new ArrayList<>();
// Populate list with list.add()
Bukkit.getScheduler().runTask(plugin, () -> { callbackMethod(list); });
}
...
// In JavaPlugin class:
public void callbackMethod(List<String> list) {
this.list = list;
}
Is List / Arraylist okay to use here for passing a list of strings back to the main thread?
I intend to add, remove and read from this List on the main thread.
Well depends on whether or not you plan to mutate the list after you passed it back to the main thread through the callback
if you only write to the list on thread A, then "send" it to thread B and thread B is then the only one that mutates/reads the list you are good
Does anybody have an idea on why this isn't working properly?
for(Entity snowballs : snowballs) {
Particle.DustOptions dustOptions = new Particle.DustOptions(Color.fromRGB(52, 164, 235), 2.0F);
world.spawnParticle(Particle.REDSTONE, snowballs.getLocation(), 4, dustOptions);
This is inside of a BukkitRunnable task timer, delay: 0, period: 1.
The particles are supposed to spawn constantly behind the snowball, like a trail, but in the game it spawns it only once and stops spawning the particles.
Also why is the name of the list and snowball the same
Yeah that is just me being dumb
that is some cursed formatting
i couldn't be bothered ok
i usually format it after i get everything working
And well, no idea what snowballs is or how it is filled, but you cancel the runnable if a single one of your snowballs dies
it's an arraylist with the snowball entity
even if i spawn only one it still doesn't properly do it's thing
IQ 💀
Is it possible to set 2 permission to one command and if the player has one of them it will work?
Yes use an if check
Make sure to still define them in the plugin.yml
But under the permissions section rather than under the command
is there an easy way to make it so a banner doesn't get removed when the block under it gets removed?
What do you mean?
Hm try BlockPhysicsEvent
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
Oh, so I can set child permissions here and set the description of the permissions?
I really want to avoid that if possible
Hm not sure then
it's just for a couple of blocks and only during a specific timeframe so I'd rather dump a repeating task on the block than listen to a physics event
I see
Ok... Minestom.... I NEED someone to make it for me
Minestom has a great api
What is a minestom
A server implementation
Why can I not do this?
It says. You can't use generics there
yeah ik, I'm asking why generics can't be used
What is a generic
Just curious, why do you need this?
Hello good people of this server.
I am once again coming here to seek help.
The method World.spawnFallingBlock(Location, BlockData) spams the logs every time I spawn a falling block.
Any way to prevent the spam ?
https://prnt.sc/Xi5FMaOl0Yy2
seems like you're spawning the same falling block multiple times
does anybody know why even if the balance is higher than the "money to give" it is sending me the "your balance is too low etc.."?
hang on
if(balance >= moneyToGive){
bm.removeBalance(p.getUniqueId(), moneyToGive);
bm.addMoney(target.getUniqueId(), moneyToGive);
p.sendMessage(ChatColor.GREEN + String.valueOf(moneyToGive) + "$ has been given to " + target.getName());
target.sendMessage(ChatColor.GREEN + String.valueOf(moneyToGive) + "$ has been given to you by " + p.getName());
}else{
p.sendMessage(ChatColor.RED + "Your balance is too low to give to " + target.getName() + " " + String.valueOf(moneyToGive) + "$");
}```
I am simply using the method provided by the API.
I do not do any additional changes on the entity.
https://prnt.sc/kUjF4rGZHVdE
okay first off, String.valueOf(Integer) in a multiple part string does the same as just putting the integer. Secondly, that code provided there without context should work, did you forget to hit /reload or something?
nope i didnt
a tutorial for: how to get a custom head?
the error message says you're attempting to spawn in multiple entities with the same uuid. Something must be happening that is causing duplicate UUID's - something that isnt allowed to exist. Maybe try createBlockData().clone() ?
afaik you can turn a skin into a object and store that. Other way around, you should be able to turn a skin object into a head
I can assure you that creating block data has nothing to do with the entity's uuid
im guessing on that one
Went through the spawn code and found that if the the CraftEventFactory.callEntityChangeBlockEvent is not cancelled it spawns a new entity.
Then it spawns a new entity again.
If I understood this correctly it would be a problem in Bukkit (?).
Can somebody confirm ?
https://prnt.sc/PN7OeZU77H75
I created a BukkitRunnable and then store it as BukkitRunnable myRunnable;. I then do myRunnable.runTaskAsynchronously(plugin) to start it.
If I try to cancel it from the outside via myRunnable.cancel(); it doesn't stop. How can I force an async runnable to stop from the outside or is this not possible?
inside teh async while (!isCancelled())
your code has to have an opportunity to exit too
i have a question regarding the chunk format: https://wiki.vg/Chunk_Format
I dont understand how i can interpret the single valued pallet, because it only has 1 value and in the description it says, that "Data Array sent/received is empty"
so where is the chunk data?
I have that code for BlockPersistentDataStorage: ```java
Player p = (Player) sender;
if (p.getTargetBlockExact(5) != null){
Block block = p.getTargetBlockExact(5);
BlockState state = block.getState();
if (state instanceof TileState) {
TileState tileState = (TileState) state;
PersistentDataContainer data = tileState.getPersistentDataContainer();
if (data.has(new NamespacedKey(plugin, "easter"), PersistentDataType.INTEGER)){
if (data.get(new NamespacedKey(plugin, "easter"), PersistentDataType.INTEGER) == 2){
data.set(new NamespacedKey(plugin, "easter"), PersistentDataType.INTEGER, 1);
p.sendMessage("Acum nu mai e item special");
}else{
data.set(new NamespacedKey(plugin, "easter"), PersistentDataType.INTEGER, 2);
p.sendMessage("Acum e un item special");
}
}else{
data.set(new NamespacedKey(plugin, "easter"), PersistentDataType.INTEGER, 2);
p.sendMessage("Acum e un item special");
}
}else{
p.sendMessage("32");
}
}else{
p.sendMessage("1");
}```I put ``p.sendMessage("32"); to detect where is the problem, and when I execute the command it says me 32, why??
why block.getState() doesn't instanceof TileState?
Well are you looking at a block with a tile state
what blocks are?
but is possible to give a persistent data to a default block?
So cancelling the event does NOT cause the duplicate UUID/spawning of FallingBlock twice
Where should I report this bug.
https://prnt.sc/0ApPLbIHKbkP
Its not a Bukkit bug. No one else is having duplicate Entities spawning
hi im trying to make an npc with mojang maping but al the tutorials i find are bad. does annyone know a good one for 1.18?
So what is it then ?
Are you using a spigot fork?
I am using Spigot I built using Build Tools downloaded from the spigot website
Then no idea. What you are describing should be impossible
You can try it yourself.
Many here have use FallingBlock spawning for many years with no issues
I know
Which means it has to be something to do with how you are doing it. Your code
I literally removed every single plugin and kept only the bare minimum to spawn it with a command.
Could you please try it yourself to confirm that it is my mistake ?
Try what? I have code that spawns a falling block. It works fine
Then I am utterly confused.
?paste
https://paste.md-5.net/motiyolade.java Fires a block using FallingBlocks
I will create a brand new server and use the code you sent to see if it still does that.
wait a sec
https://prnt.sc/Cb4-xqEzSpEh
https://prnt.sc/6OKbdg28y0KO
Still happens
Brand new server
New plugin
are you using teh full spigot and not just CraftBukkit?
anyone knows JDA?
The server brand name is "Spigot" server
The version is in the second screenshot at the bottom
those UUID errors in your SS are displayed before your server even starts?
No
I logged in
Broke dirt block and started left clicking
The error showed: 1 error for 1 block thrown
um, seems you are correct. in 1.18.2
?stash I think
I have that code: java @EventHandler public void Click(PlayerInteractEvent e){ if (e.getAction().equals(Action.RIGHT_CLICK_BLOCK)){ Player p = e.getPlayer(); Block block = e.getClickedBlock(); if (BlockMethod.isSet(block)){ if (BlockMethod.getBlock(block).isEastered()){ p.sendMessage("Haolo, ce bine e"); } } } }
But I get 2 message like "Haolo, ce bine e". Why?
looks right
but if I build with another block, it says only 1 message
Thanks
np!
once for each hand
wdym?
I see, you are testing for right click
yeah what's up? bear in mind JDA has their own support discord which will be better for most issues.
yep
with what i need to replace it?
make your command class extend TabExecutor, add the tab method
in that method you can set your own subcommands to be shown on tabbing
not extends, implements, oops
well
it would be cool if we can dm
Erm why? why can't you just ask here?
because this is the spigot discord, which is for spigot. asking in the main discord would yield more help more likely
this isnt spigot
its JDA
ah, I misread sorry
I'd prefer not to DM so u can just ask me in general or smthing, or in jda since im in there as well
fine ok
how to get a guild that the bot is in
?npc
JDA#getGuildById
So you're using a selfbot?
ig? dunno whats that
Update your JDA to latest and use a bot account
well i cant get the bot to be in the server i wanna get
that can easily get you banned
annyone know a good tutorial for making an npc with mojang maping in 1.18?
shit
I'm not going to, nor is 99.9% of people, help you self bot.
Selfbots are not supported behaviour and can work differently to bot accounts. Additionally they are explicitly disallowed by discord.
https://www.spigotmc.org/resources/»-the-best-ranks-«-gui-support-papi-support-easy-to-use-and-the-best-rank-plugin-ever-made.71674/
can any minecraft plugin developer update a 1.15 plugins to 1.18.2 free for me? (I'm not a developer or the plugin author) I just hope someone could update it, it's a really good rankup gui plugins
dm me to obtain the source code
Alright, thank you for telling me
you're gonna want to pay someone
hmm
free work is not going to get you anywhere
and make sure you obtain permission from the original author(s) if you can port their plugin
ye I did
ah ok
he gives me the permission, so I use http://www.javadecompilers.com/ to obtain the plugin source code
he said he's busy and developing a plugins call split or steal, so he tell me to do that by myself
best part is that the src is not written in english
I also don't see anything version-specific so it could work on 1.18
Oh no
it's just not tested
Let me guess it's german
Odd it's usually german
Whats happening here?
hmmm rip...
need to make it atomic I think ?
Very fitting XD
put it inside the runnable
First test it and see if it still works
not working after 1st rankup
If not find what isn't working and start there
I doubt this is a version error
How can I cancel a task?
Just like you did above
?scheduling I recommend using the BukkitRunnable. Learn more about it here
who know any good rankup gui plugins like that I shown..?
make i to AtomicInteger and the array to AtomicReferenceArray<String> ?
Not sure about the array part though
ah yeah, whoops
But why though
you can store the runnable as a BukkitTask and call cancel from that instead of storing as int
Could not find spigot-api-1.18.2-R0.1-SNAPSHOT.jar (org.spigotmc:spigot-api:1.18.2-R0.1-SNAPSHOT:20220324.024706-24).
Any idea? The build.gradle: https://pastebin.com/ZZ6vFKKy
BukkitScheduler scheduler = Bukkit.getScheduler();
scheduler.runTaskTimer(instance, task -> {
if (i.equals(7)) {
task.cancel();
return;
}
p.sendMessage(arrayList.get(i[0]));
i[0]++;
}, 0L, 20L * 60L);
What do these 3 values mean at the end?
2nd one is delay
and the 3rd one is how frequently in ticks the task should be ran
that's not 2 values that's a multiplication
usually just keep the delay to 0
and inside a bukkitrunnable you can just do this.cancel()
So this will repeat every 60 ticks right after 20 ticks?
oh
Hehe, tf is happening here, it worked just fine and now it's spitting out this error.
Could someone explain ?
thats seconds
20 ticks is 1 second, so 60 * 20 is 1 minute
OH
60 seconds, multiplied by 20 to differentiate the ticks
yes
are you running the latest protocollib version
also don't use a lambda if you want to cancel
First ("0L") is the delay from when it will start that runnable, since it's "0L" it'll start imediatly.
The second value is the time between running and since 20 ticks ("20L") is a second you are waiting 60 seconds between each "activation".
I should be, lemme check
How would I cancel it with runnable?
bukkit runnable
BukkitRunnable
I recommend you the docs when you dont know the parameters.
if you want to cancel from outside the runnable, you can store it as a BukkitTask
BukkitTask task = schedule runnable here
?jd
yup, newest version, still am getting the error
Ah, sry for the ping
What the said the warning?
there's no point going to docs for a small query like this
using ".equals()" instead of "==" I believe
no warning just needed help cancelling a runnable
I know but the docs are there to be used if not i ask everything and spam all channel with questions
😂
The same now that I realize it is the custom
I'm so confused, it wors once, and then it just stopps working
@EventHandler
public void onPlayerJoin(PlayerJoinEvent event) {
event.getPlayer().getServer().broadcastMessage(ChatColor.translateAlternateColorCodes('&', "&8[&a+&8] &7" + event.getPlayer().getName()));
ItemStack profile = new ItemStack(Material.PLAYER_HEAD);
SkullMeta meta = (SkullMeta) profile.getItemMeta();
meta.setOwningPlayer((OfflinePlayer) event.getPlayer());
profile.setItemMeta(meta);
meta.setDisplayName(ChatColor.translateAlternateColorCodes('&', "&d" + event.getPlayer().getName() + "'s Profile"));
event.getPlayer().getInventory().addItem(profile);
event.getPlayer().sendMessage("test");
}
i dont get the player head but i do get the test message, no console errors
you might need to wait a few ticks before giving the player an item ?
try to give another simple item instead?
I'm gonna try playerspawnlocationevent
playerjoinevent sometimes needs to be delayed for a couple ticks to see results
fixed it by using a bukkitrunnable
NMS question
what's the difference between the 2 pathfinder goals any EntityInsentient has?
can you check if a user has permission from a database
Player#hasPermission
And then the classes: PermissionAttachment
how can I count the amount of blocks of the same type on one blockface?
e.g I got a sponge and want the number of sponges below it
What is permission attachment
also how can I pass in an object or my database into the .hasPermission method
Can I?
I asked how to use hasPermission with a database
I want to access whatever permissions I store into the database
if player has permission that’s inside of database {}
Permissions are given to a player, you check if the player has a permission as we just said.
if you store a permission string in a database, it should be as trivial as just querying and checking with hasPermission
Hello!
I'm trying to give a npc a custom skin but I'm having some trouble doing so.
gameProfile.getProperties().put("textures", new Property(config.getString("npcs.jeff.texture"), config.getString("npcs.jeff.signature")));
I saw this code in a tutorial so I tried it but it doesn't seem to change the skin. Am I forgetting something? Please let me know.
Thank you!
I'm getting the skin texture and signature from this site:
https://mineskin.org/
No I’m storing the permissions and making my own permissions system
why?
Idk if that works but I’ll try
everything must be custom.
There is a full blown permission system already
Yeah I’d rather make my own simple system.
isn't luck perms the defacto standard for perms
🤔 reinventing the wheel here for no reason seems pretty not clever, especially with how good luckperms is
yeah, you have a lot of features, a web editor, api, etc.
no point in just doing all that again
but ig he could be making a simple system just to understand how it works
someone?
I’m making my own web editor and my own simple permissions command/editor. My goal is to make a fully custom server
Also I understand how it works I just have never queried with a database before in Java only JavaScript so idk how to access columns, or if I can with .hasPermission(permissions)
Yes please
Thanks
if you want to use it in a serious manner, also look at connections pools (I would suggest https://github.com/brettwooldridge/HikariCP)
Guys can someone teach me about doing a local mysql I mean I know how mysql works and all that but I don't know how to make the plugin put the database in its plugin folder and use it database for my plugin
A plugin does not "put a mysql db into its plugin folder"
research SQLite or h2
its a command
mysql is a service you run on your local system
any idea
yea ^^ sqlite or h2 for a file based db
Thanks also is this a project I can install using Maven, I’ve never used maven before
it is a warning that you implemented (probs CommandExecutor) ? Without the not null annotations
Yes
Okay thanks
generally, maven/gradle are the standart
basically anything should be usable through them
I don't know how to explain it and I think I expressed myself wrong but I have seen plugins that have a local database that they save in their plugin folder
Yea that isn't mysql
I’m going to learn then
that would be sqlite or h2
Do you mean like a database.db file
Yes
Yea
Like luckperms
sqlite or h2
No worries 👍 I believe luckperms uses h2 by default
Which of both is better?
I'd go with h2 ye
Ok thanks
sounds like you failed to register your command in the plugin.yml
i forgot that existed for a second 💀
😅
List<Block> lastTwoTargetBlocks = player.getLastTwoTargetBlocks(null, 6);
this function doesn't ignore water and lava blocks. is there a way to make it do that?
the passed set iirc contains materials that should be ignored
when i replace the null with a set of materials with Material.WATER it doesn't behave as expected
and its hard to describe what its actually doing
public static BlockFace getBlockFace(Player player) {
Set<Material> transparent = new HashSet<>();
transparent.add(Material.WATER);
transparent.add(Material.LAVA);
List<Block> lastTwoTargetBlocks = player.getLastTwoTargetBlocks(transparent, 6);
if (lastTwoTargetBlocks.size() != 2) return null;// || !lastTwoTargetBlocks.get(1).getType().isOccluding()) return null;
Block targetBlock = lastTwoTargetBlocks.get(1);
Block adjacentBlock = lastTwoTargetBlocks.get(0);
return targetBlock.getFace(adjacentBlock);
}
this is my function right now
could it be that my distance is less than 100?
How should I go about making an anti kill boosting system? I want to stop giving kill rewards if you kill the same person 3 times in a row
if you're on the latest versions there's player.getTargetBlockFace iirc
hashmap should be the thing
something like https://stackoverflow.com/questions/4956844/hashmap-with-multiple-values-under-the-same-key would work?
I need to store if the same person is killed 3 times
By 1 player
and if so set them on a cooldown for rewards
you could make a custom class that holds 2 values
map<uuid, customthing>
where the custom thing holds a map of people which you have killed and the amount of time
you could try do map<UUID, map<UUID, int>>
hm ok thank you
Do dev need to provide source code of there premium plugin?
are they obligated by any rules
it's always public using a decompiler
Well, if you want to be serious about GPL 3
if you have the jar
i have heard that you could obfuscate it a little
how do i update to the latest version?
Your issue is technically https://www.gnu.org/licenses/gpl-faq.en.html#GPLRequireSourcePostedPublic
i assume its something in the pom
so an minecraft is under this license
an minecraft ?
I heard before they was some licence which demands any mod to be open source
or something like that
i will never understand those types of licences 🥺
all those licences lol
any
does papermc have special things that spigot doesn't? I'm trying to use Player#getTargetBlockFace(), but its not in my spigot api lib
replacement for Inventory.getTitle in 1.18
no
inventories no longer have their title
the InventoryView does
which you can access from your event
is this for papermc or spigot?
Yeah seems like a paper thing
damn, that stinks. ok
thanks anyways
wish i could see implementation
if PaperMC is open source i might be able to
paper is also open source yes
public HashMap<Player, Integer> map = new HashMap<>(); how do i access the integer?
idk I just like final
I would also suggest to use the players UUID instead of the instance itself
k
How can search on google how to do this:
String text = "My name is {name} and i am {age}";
MessageHandler message = MyPlugin.getInstance(). getMessage();
message.replace("{name}", "alex", "{age}", 20).send(text, player);
How would i search to do the replace part?
how to do what
👀
The .replace
That what i dont know how to do it
I know that for replacing the {} (variables/placeholders) i use Patterns
lol why in two chained methods
The replace depends entirely on what the fuck MessageHandler is
wait wha
Its my own class dont give attetion
Well strings have a .replace method ?
My goal is to when you don .replace("{varname}", var-value) its get replaced in the text you passing
But i dont know how to be able to have more than 1 var
Do i explained?
You want your method to have a variable amount of arguments ?
varargs?
how do you stop certain path from minimizing in gradle shadow
Wait i will use the translator
What paths minimize in gradle shadow 🤔
Im already told im not native speaker
im not one either
👀
I want to know how I can do the replace(variables, values) method with many variables, something like this:
replace({var-1}, "value-1", {var-2}. "value-2")
It's what I don't know how to do
Google "java vargargs"
Oh ok
String... is what you want
And them how do i parse each value to each var?
however, you will have to enforce an even amount of arguments
That what i dont know
varargs is just a string array
and Validate(args.length % 2 == 0) kekw
Yes i know
But im confused how to parse each var with each value
Yes
so match those
so i will have to do a loop and match every 2 args together
smth liek
for (int i = 0; i < args.length; i++) {
str.replace(args[i], args[i + 1]);
i++;
} ```
not sure about the indexing
Anyone that can give me spigot 1.8.8 repo gradle?
the instructions for maven should suffice
yuh sure
String... names == String[] names right?
Sorry for tag
Allr thanks
Because intellij oblise me to use @VarsArgs annottation with String... bla
lol
String... is easier
a lot easier
lol where is the time that you could find enchanted books with a fishing rod
only catching damn fishes
:cloud-builder-shared:cloud-builder-shared-cloudserver:test: Could not find net.md-5:bungeecord-chat:1.8-SNAPSHOT.
Required by:
project :cloud-builder-shared:cloud-builder-shared-cloudserver > org.spigotmc:spigot-api:1.8.8-R0.1-SNAPSHOT:20160221.082514-43
now i get this
Hello!
I'm trying to give a npc a custom skin but I'm having some trouble doing so.
gameProfile.getProperties().put("textures", new Property(config.getString("npcs.jeff.texture"), config.getString("npcs.jeff.signature")));
I saw this code in a tutorial so I tried it but it doesn't seem to change the skin. Am I forgetting something? Please let me know.
Thank you!
I'm getting the skin texture and signature from this site:
https://mineskin.org/
p.sendMessage(ChatMessageType.ACTION_BAR + "" + ChatColor.GRAY + ChatColor.BOLD + "You have received Starter Dagger");
??
Not quite how you do that 😅
declaration: package: org.bukkit.entity, interface: Player, class: Spigot
definitely not how people did it
you have to convert your stuff into bungee chat components
does anyone know why this happens ?
could someone please help?
i have a right click event
it runs just fine all the way to the end
but then the server crashes?
java.lang.AssertionError: TRAP
basically invalid state
spigot caches if the item is empty
Do you send a meta data packet?
You also need to delay the hiding the npc
according to google thats causing the error?
even the sout item removed works
basically you are removing an item in the interact event
e.g. the server now thinks the player is interacting with AIR
which is impossible
Not sure what you mean exactly. I'm new to creating npc's
This is my code:
Player player = (Player) commandSender;
MinecraftServer server = ((CraftServer) Bukkit.getServer()).getServer();
WorldServer world = ((CraftWorld) Objects.requireNonNull(player.getWorld())).getHandle();
GameProfile gameProfile = new GameProfile(UUID.randomUUID(), strings[0]);
FileConfiguration config = MyFirstPlugin.configfile.getConfig();
gameProfile.getProperties().put("textures", new Property(config.getString("npcs.jeff.texture"), config.getString("npcs.jeff.signature")));
EntityPlayer npcPlayer = new EntityPlayer(server, world, gameProfile);
npcPlayer.b(player.getLocation().getX(), player.getLocation().getY(), player.getLocation().getZ(), player.getLocation().getYaw(), player.getLocation().getPitch());
PlayerConnection connection = ((CraftPlayer)player).getHandle().b;
connection.a(new PacketPlayOutPlayerInfo(PacketPlayOutPlayerInfo.EnumPlayerInfoAction.a, npcPlayer));
connection.a(new PacketPlayOutNamedEntitySpawn(npcPlayer));
connection.a(new PacketPlayOutEntityHeadRotation(npcPlayer, (byte) (player.getLocation().getYaw() * 256 / 360)));
connection.a(new PacketPlayOutPlayerInfo(PacketPlayOutPlayerInfo.EnumPlayerInfoAction.e, npcPlayer));
spigot has a check for that, which you ran into
Anyone knowing why gradle isnt building my dependencies into jar file?
Delay this line connection.a(new PacketPlayOutPlayerInfo(PacketPlayOutPlayerInfo.EnumPlayerInfoAction.e, npcPlayer));
I do 200 ticks but up to you
then the server does not continue with its logic
plugins {
id 'java-library'
}
group 'club.practicing'
version '1.0-SNAPSHOT'
repositories {
mavenCentral()
maven {
name = 'bungeecord-repo'
url = 'https://oss.sonatype.org/content/repositories/snapshots'
}
}
dependencies {
api project(':cloud-builder-shared:cloud-builder-shared-cloudproxy')
compileOnlyApi 'net.md-5:bungeecord-api:1.18-R0.1-SNAPSHOT'
compileOnly 'org.projectlombok:lombok:1.18.22'
annotationProcessor 'org.projectlombok:lombok:1.18.22'
}
This is my build.gradle
and you don't run into this
Alright, I'll try.
e.setCancelled(true);
p.getInventory().remove(item);
System.out.println("item removed");
```?
just like that?
hey there, quick question. does anybody know how i would go about getting the rgb colors of items in the inventory?
is there any list or something.
You are fine if you cancel the event at any point iirc
aight ig thanks
try it, I might be wrong
Doesn't change anything
what exactly is failing ?
not building the dependency into a jar file ?
wouldn't you want the dependency to be shadowed into the fnal jar
where and how can I save my Objects with their pharams, because when my plugin is disabled, all objects missing
You may override onDisable in your plugins main class
why are there that kind of idiots that do super.onDisable()
and for onEnable?
you'd want to load your data from your persistent storage
what you tryna do
you probably need to parse the game's textures yourself
does anybody know wtf is wrong with this? i made like 4 plugins today and they worked fine
😅
Sorry to interrupt, quick question:
Is there a way to detect a player clicking with the mouse scroll wheel? (player being in survival, preferably)
i think that there is a click type called like "middle"
like ClickType.MIDDLE
just make a playerclickevent listener and check if the clicktype it's ClickType.MIDDLE
I have a plugin using 1.8 as the minimum version, is it possible to support rgb on 1.16+?
great, thank you 😊
you want to use rgb in 1.8?
because rgb was implemented in 1.16 i think
"is it possible to support rgb on 1.16+?" - my quote
no, my plugin will only allow rgb if the version is 1.16+
ohhh
just check if Bukkit.getServer().getClass().getPackage().getName().contains("1.16)
idk if it will work but try
Okay thanks
np ^^
oh yeah that's true
How are hypixel mini game servers ran? They obviously didn’t manually setup 3000 bungee servers so how would I create miniature servers for a mini game?
you could make like a list of versions (under 1.16) , and then check if the package name contains each key
idk, never made something like that
you can start servers with virtualisation software like docker
obviously you don't have to either
basic code I have an idea for
public boolean is116orabove() {
String ver = Bukkit.getServer().getClass().getPackage().getName();
if (Integer.parseInt(ver.split(".")[1]) >= 16) {
return true
}
return false
}
you could very much build your own solution that provisions servers just on plain disk
might work
the package name contains a bit more than just the version number
oh
Never done something like that, I currently have a bungee server separated on 2 powerful machines running at home, each machine runs 2 servers and I have a 3rd machine that I’m planning on reserving for mini game servers
The 3rd machine is older running a less powerful i3 but it should make do for miniature servers that don’t require much resources
I mean yea, that is a bit more work if you want to build it from the ground up
And right now I have batch files with a script to handle restarts
Probably not the best way but it works fine for the servers I have now
But when I make mini games I can’t have 100 batch files running small servers
so anyways, my original question. Is this possible at all
how do I setup multi version for my plugins so the plugin works on 1.17.1 1.18.1 yada yada yada
if using NMS you use modules
IJ
Proprietary software running servers from templates with a control panel
You wouldn't even need proprietary software. You could setup a network like that with docker or kubernetes.
Probably would still need something proprietary for the starting and stopping of sub servers
Is there a world name length limit?
48 characters
Alright, sounds fine
is there any fun plug-in challenges/ideas that i can make
sound engine
unless you aren't a literal god at minecraft
then just make a minigame
You can also just mess around with pathfinders
I made satanic cows with those
is there any way to make an armor stand direct invisible? because i am using this funktion to summon an armor stand:
ArmorStand stand = (ArmorStand) e.getEntity().getWorld().spawnEntity(loc, EntityType.ARMOR_STAND);
stand.setVisible(false);
stand.setGravity(false);
stand.setMarker(true);
but its always a short time visible when i spawn the armor stand
Marker should be an actual entity now
otherwise you can just spawn it at 0,0,0 and teleport it
is an marker able to show an his custom name
yea good idea
try it and see
if(event.getBlock().getType().equals(Material.POPPY)) {
Location blockLocation = event.getBlock().getLocation();
opiumCoords.add(blockLocation)```
Atm I have this setup so when a player places a poppy it gets the coords and adds it to an array. However, when I restart the server the array will clear so how do I make it not clear
you can write it into an config file or on an data base
Yea you can write it to a file
i cant show you an example rn cuz i am not on my pc rn
Ah so they have a template loaded then software creates a directory with the files when a new server is created
and adds it to dns and such
You don't need javafx
just make a command-line thing
but it is quite technical
I think I have it written somewhere
So are every one of those servers port forwarded? Or something like that
all the servers are linked to like 100 bungees
those 100 bungees are handled via dns
so yeah in a way
I could use a router api to add port forwarding profiles when a server is created
And have the port increment by one each time it’s created
however you want
I think the version I have in hand uses some sort of cloudflare api
I don't think I can share it without getting shot
Oh lmao I’ll think of something then
yeah I don't want minigame networks going at my kneecaps
I can give you some ideas but that's about it
How can I use rest api in Java to check if my database has been updated?
Use jdbc then check if the value exists
Okay thanks
Or check the length of values and if it’s increased then do something
for my friend...
he's having pom.xml import errors for 1.8.8
Show the Pom.xml
?pastr
?paste
?paste
Yeah paste it there
Everything seems fine, are the dependencies valid? Does maven show any errors?
me :D
when i try build?
Why not use the api?
Do you have an antivirus that might mess with it
no
i have windows defender which is disabled
it says
it cant find the files
but i can see them in file explorer
nuke your .m2\repository folder
lol
close intellij first, delete folder, then reopen and try again
I've had many problems in the past with dependencies randomly not resolving and clearing out the folder fixed it
dev-SNAPSHOT?
and worldedit will not be in the spigot repo
in your pom <artifactId>spigot</artifactId> You need to run buildtools to make spigot
I have no problems loading the dependencies from your pom.xml
I'm guessing he's set to local only or somethign silly
there is an offline mode in IJ
I don;t use it so no idea where
Please don't do that
You just waste time by removing all your libraries cached
There are many methods that can relocate them
And deleting it will only cause problems if you have multiple projects
I have never seen this one before, anyone have any ideas? https://cdn.discordapp.com/attachments/320603307494211584/965340594119520356/unknown.png
?paste
don't have the paste because I don't have the error
I'm trying to get started with creating npc's but when I try to create a simple command that spawns a npc I get this error:
Caused by: java.lang.ClassNotFoundException: net.minecraft.world.entity.player.Player
This is my code: https://paste.md-5.net/ovifopayul.java
Could someone please help me?
Why does my server stop responding when I use the placePlotOnNextAvailable Method? Here is code and error: https://gist.github.com/ItzJustNico/3e1e4806a18d14161969ca0880b7dd6f
whats the code, what are you doing?
the code is below
ah
if your looping through 3 axis
you need to loop through them sequentially
sec
Is it possible to create custom statistics or am I stuck making a system from the ground up 👀
What type of custom statistics?
Like one's MC uses, though I'm not sure if possible to even extend those without NMS 😐
net\minecraft\stats
ohh i see so like extending the Enchantment class but for Statistics
Ye
i would assume you need NMS ive never seen any statistic class hmm
damn
guess I can just yoink those classes 👀
I know org.bukkit.Statistic is a thing, but I wasn't sure if there was anything else
Could anyone please help me?
wdym like that
Yep i was looking through that too and thats the only one i saw
nah theyre stored server side
There's server-side stuff, but I wasn't sure if there was a way for plugins to handle custom ones or not
The client still needs to know them because you'd need to have a translation. I imagine you can't easily add one without a mod
hmmm, it wouldn't be something viewable in the stats menu... however I guess in this case I'll have to do something custom, annoying
can anyone help pls?
Choco said smth yesterday but Idk how I can fix that
?paste
I'm using that for my own thing lol
Something like this maybe https://paste.md-5.net/epomuxagof.cs
@noble lantern
I'm sure there's a better way of doing it besides just having it be a String name i.e. StatisticManager.getStatistic("Example") since that means remembering every statistic name
how do i get a skull texture from an offlineplayer object?
yes
Ah then use SkullMeta
what exception should be thrown if a class has a constuctor with invalid arguments? I'm making sort of an api and I need some classes to have a 0 arg constructor
with should be thrown i mean what exception should I make my code throw
illegalargumentexception
thanks
Guava's Preconditions.checkArgument() will do that automatically based on a condition if you'd like. We use it in CB all the time
(Guava being shaded into Bukkit)
I guess this would work for now 👀
i've probably phrased my question wrong
I have an abstract class that the api user can extend
and they must have a declared constructor with no args
then my code tries to create a new instance with the newInstance() method from Class with no args
and if it fails, it should throw an exception letting the developer know they did a mistake
In which case you can't really enforce that without re-throwing an exception wrapping the reflective operation exception at runtime
try {
// create the instance reflectively
} catch (ReflectiveOperationException e) {
throw new IllegalStateException(e, "Missing no-arg constructor");
}```
Does spigot support mixins by chance? you could also add your enum directly to the enum map but i doubt it
that's what I am doing basically
ISE is probably the most appropriate one here unless you want to make your own exception
i was wondering what should I throw as a wrapper of the original exception
yea that's what im doing basically
so illegalstateex it is
thanks

I'd rather not do it in a hacky way, so I'd be better off just re-implementing it.
Think that would be an okay impl or could it be done better?
spigot also doesn't support mixins :p
Well, it's just not provided
You can shade Mixins on your own if you want, no? Or does the server require it?
seems good to me, its definatly the most simple way only issue now is saving that statistic to a file/database 😛
not sure i never used them on spigot tbh
Even then, I'd rather not go about shading a dependency just to be able to use the statistic classes that are already made lol
That'll be part of User loading/saving, there'll be other methods within the Statistic class however I just needed a quick example
I am trying to add nuvotifier dependency to my maven but looks like that is not working from some reason
I tried to clone it from github but I am not sure what do I need to run in gradel to install it to my m2 repository
any one can help with that
Did you add the Jitpack repository?
That artifact looks to be old
In fact, the dependency information is all over the place
It suggests the following:
<project>
...
<repositories>
<repository>
<id>jitpack</id>
<url>https://jitpack.io</url>
</repository>
...
</repositories>
...
<dependencies>
<dependency>
<groupId>com.vexsoftware</groupId>
<artifactId>nuvotifier-universal</artifactId>
<version>2.6.0</version>
<scope>provided</scope>
</dependency>
...
</dependencies>
...
</project>```
but that dependency doesn't look like Jitpack would service it because that repository doesn't exist, and the NuVotifier/NuVotifier repository doesn't have any artifacts as far as I can tell
so what would be solution
I mean you can try that artifact if you want
I tried to clone it
sorry don't understand what u mean
<dependency>
<groupId>com.vexsoftware</groupId>
<artifactId>nuvotifier-universal</artifactId>
<version>2.6.0</version>
<scope>provided</scope>
</dependency>```
If that doesn't work, you can build (and I think install) it locally by going into your command line in the project root and running ./gradlew build
(or however you execute a file. For windows, you need the ./)
2.6.0 not working for me
I tried
to do ./gradlew build
and didn't show up in my m2 folder
You can add the file manually as well.
mvn install:install-file groupId=com.vexsoftware artifactId=nuvotifier-universal version=<version_number> packaging=jar file="path/to/file.jar"
(in the command line)
Wherever the built file for NuVotifier is
ok
If you run that command while you're in the build directory of the project, you can just do file=NuVotifier.jar (or whatever the file is called)
It's relative, or you can do absolute with C:/, yeah
post plugin.yml
an issue in the description of the plugin
but pls give us your plugin.yml
wdym i have??
name: Watch-Kitten
version: '${project.version}'
main: me.anticheat.WatchKitten
api-version: 1.8.8
authors: [ KittenPixel ]
depend: [ ProtocolLib ]
description: The kitten is always watching! 👀
where on windows do i check again which spigot version i have compiled through build tools already?
solved
its under C:\Users\<User_Name>\.m2
ok
How do you edit the way ender pearls work in your server? So I can make taliban pearls, cross pearls, pearling through fence gates, etc
oops forgot Protocol Lib too I was changing my anti cheat version
?paste
how to get a live preview of my online players for my scoreboard? atm I call my method in my PlayerJoinEvent but it does not update if a new players joins :/
How i create an item stack based the id? - Thanks
I would not loop online player like that but do something like int onlinePlayers = Bukkit.getServer().getOnlinePlayers().size
thank you :)
you don't need to do get server I don't think
How do you edit the way ender pearls work in your server? So I can make taliban pearls, cross pearls, pearling through fence gates, etc
Anyone know?
taliban pearls? what are they gonna do? take over afghanistan
allahu akbar
He is trying to do a plugin for pearls. So the pearls can go through fences, gates, doors, etc. Like does the premium plugin called Taliban Pearls
ahhh
Do you know how to do it
Hey there. Im trying to make a custom crafting table for specific items in my plugin. Now not worry about the whole custom recipes and stuff because ive already figured out how im going to accomplish that, when I create a new inventory with the inventory type of WORKBENCH none of the vanilla crafting recipes work. I can place stuff in and such but no result will come out of it. Any way to fix this? Or any way to add recipes to the specific workbench inventory?
How would I adapt a center location to move a region? Like let's say there is a cornerOne in top left and cornerTwo in bottom right- and I want to move them solely based off the center location (and it recalculates it)... what would I do??
Well if you're moving relative to the center, just modify the coordinates equally on both corners
If you want to move x-5, y+2, z+7, doing that on both corners will move your center by that amount without changing dimensions at all
I might be misunderstanding your question though
Well my problem is I don't know how I'd find the difference between the two coordinates and if it'd bug it out
Say like x-x but it returns a negative- it'll mess it up
The given corner location is always random so I have to find the difference somehow
Oh wait I'd get the distance from the corners center and then I'll adapt it to my corners and center- okay let's see.
Anyone have any suggestions as to how I can get or make a h2 sql utils that makes it easier to use h2?
What would be the name of the packet to set a prefix for the player via BungeeCord?
e.g. BungeeTabList+ also does this via Packets otherwise this would not work or does someone know better?
for this, List<Block> lastTwoTargetBlocks = player.getLastTwoTargetBlocks(null, 100);
passing a Set<Material> of with water in it should make it ignore water right? and just have it act normally just with a "block blacklist"?
ill say ive tried this and it doesn't act how id expect. its hard to describe its behavior though.
i wish the paper function player.getTargetBlockFace was in spigot, so badly
Well, there is a rayTrace() method which can get you a target face iirc
but yes, a Set of water would ignore water
k, well it doesn't work as id expect. so maybe ill just try to figure out what rayTrace() does, and figure it out from scratch
the only thing i am worried about is putting incorrect data into it, and having it not work as id expect. but thats part of it i guess
@Nullable
public static BlockFace getTargetBlockFace(Player player) {
Location location = player.getEyeLocation();
RayTraceResult result = player.getWorld().rayTraceBlocks(location, location.getDirection(), 100, FluidCollisionMode.NEVER);
return (result != null) ? result.getHitBlockFace() : null;
}```
Should work fine
oh!
🍜
result has getHitBlockFace!
Yessir
hm. alright. thanks! ill let you know if it works out! thanks!
Both are nullable though in the case that a block wasn't hit
So, yeah, check for null
the most energetic plugin dev
im excited about all this stuff
I'm almost certain Paper's method is just a default interface method that calls exactly that above
my prior programming projects have been so dull, minecraft dev makes it WAY more fun for me
it worked just fine! thanks for the help there
o/
learn rust u scallywag
I don't hate myself that much, sorry
does "world.generateTree(pos, TreeType.TREE);" queue up blocks if a chunk the tree intersects with isnt loaded
Looking for help with LootCrates plugin for 1.18.2
It doesnt reward players with items after the player opens a chest. Anyone know how i would go about that?
is this development related
Yes.
ok there are 2 loot crates plugins which one
send the repository
im guessing you would listen to this
then just add the items to the players inventory
Im so confused as i dont know how to develop java. Is there a way to DM me and help with this a bit further if possible?
i mean this channel is for development
i mean i could just pr this to the plugin if i felt like it
which i might
are you sure you have it configured right?
I have a loot chest already setup, i can add items, set the key ect but when a player opens it and lands on the item they dont get it.
I have items set at 90% and as low as 4% chance
Imajin, is the info to edit in the crates.yml?
i would assume
HumanBehindScreenUsesHisIndexFingerToLeftClickAndTriggerFunctionalityWithinHisComputerToDrinkFromAMilkBucketInAMovingPictureGame
Event
I wouild post my code but i cant
Items:
- ==: lootcrate.objects.CrateItem
ID: 38717
Item:
v: 2975
type: APPLE
Chance: 90.0
MinAmount: 8
MaxAmount: 16
isDisplay: true
Commands: []
This is one part of it and it doesnt have a give option for the chance amount
Would it still be possible to get help with this?
First, you need to check for the Material of the consumed item
why not just use the api for this
you dont need custom inventories
Or you can directly go check it with pdc
no i want to be able to only craft the things specific for my plugin in it
you can do that easier just by modifying the result if its not related to your plugin
thats what I wanna do
issue is theres no result anyways
like
if I put in the crafting recipe for a diamond sword
nothing comes out
e.getItem() is an ItemStack, Piotr. You want to compare the type. There's also no guarantee it has ItemMeta
and getLocalizedName() probably isn't what you want
Is there an event (or way) to put someone on a shield cooldown?
Ie. if you crit hit someone it puts them on a shield cooldown
private static void createGUI() {
inv = Bukkit.createInventory(null, InventoryType.WORKBENCH, Component.text("Blue Light Saber"));
}
//farther down in the code
event.getPlayer().openInventory(inv);
@worldly ingot i havent seen u in here for a while what happened
o0h wait
ok but you dont need this at all
how so
i mean you could but
Nothing
I've been around, I'm just chilling today so I'm vibin' in the Spigotcord. IS THAT OKAY!?!?!? :((
choco always here xd
I couldnt find anything on the api after looking for a few hours
declaration: package: org.bukkit.event.inventory, class: CraftItemEvent
this is what you want mb
wait nvm
ok im just not understanding
its okay lol
you want a custom crafting table just for crafting your items
yes
ok i got it
Like hypixel skyblock if you're familiar with that?
So what I wanted to do was have it so when you interact with the block it would open a workbench inventory and disable all the unneeded recipes. Thing is no recipes work in general, like vanilla ones dont work in it either
A real workbench inventory or your custom gui?
his custom
So then just event.setCancelled() when opening the crafting nventory
.
Then open yours
ok i got it
@formal radish im sure you just creating a crafting table then listen to the InventoryClickEvent
No.
no im literally explaining how it works
Why would you listen to InventoryClickEvent?
what event would i be canceling
declaration: package: org.bukkit.event.player, class: PlayerInteractEvent
Check if the interaction is on a crafting table
right click block
if so then you can open your gui and cancel the event
what
its on right click
I meant right
so have the gui open and then cancel it or the other way around
i was like explaining to him how to check for his custom item recipes
so can i continue
if I dont have to do it that way then I dont want to
but @quaint mantle I do understand where youre going with it
so no need to explain
you dont have to if you know the block the player is using
cause then you can check the workbench is a custom one by the inventoryholder (the block)
ykw you just made me curious
imma write my own plugin for dis
Oh if you know the block you're crafting that's easy
thats not what i meant :P
"Blue Light Saber"
Meaning you can only craft a blue light saber, correct?