#help-development
1 messages ยท Page 1734 of 1
did i need to write thing inside the method ?
cuz ive been wondering for 3 weeks now
yeah its an abstract class
so you need to define it
so like
it should be easy
i write the toBase64 of itemstack in it ?
Yall got my awnser or no just say yes or no and if yes say the awnser pls,.
hang on
You talking to me or the other guy?
other guy
ok D:
@Override
public Map<String, Object> serialize() {
Map<String, Object> data = new HashMap<>();
data.put("item", item.serialize());
data.put("price", price);
data.put("shopKey", "IDK HOW TO DO THIS ONE");
data.put("uuid", uuid);
return data;
}
don't realy understand the method, this one will be call when i call object output stream ? why serialize all variable ?
well i assumed that you needed all the data saved to file
so i serialized all fields
and yes
it gets called when you call the writeObject on the BukkitObjectOutputStream
okay kinda weird method but thanks i'll make some test with this
fyi the output wont be human readable
yep i know i only want a parser to load it when server restart

do you want to save an itemstack inside a PDC?
nop
oh okay, haven't read the full conversation
np
seems like the allatori dudes have to manually verify every purchase, smh. I already regret buying it lmao
at least I got a 40% discount lol
wtf
does spigot allow allatori?
why are you obfuscating
yes, but only with certain settings
e.g. synthetize fields is not allowed
your code will be never unique and original bro
anyone got an got tutorial for opening an players inventory and updatedating it when moving items
no tutorial but you can do it your self
int i = 0;
for (UUID uuid : RegisterManager.getActivePlayers()) {
inv.setItem(13 + i, getSkullWithPlayersElementName(uuid));
i = i + 9;
}
I am filling a vertical line with heads from Players. How can I clear the space I didnt need for heads?
how?
by coding it ๐
javadocs :)
how
let's not start a discussion about whether obfuscating is useful or not... I also don't like the idea but after all it's my work and I don't like the idea that everyone could just easily copy/paste the source
- open your ide
- Learn java
i tried many things i have no idee
what's the problem exactly?
you tried not enough so
i can
Player.openInventory()
look this, it can help you https://github.com/zelytra/Histeria/tree/master/src/main/java/fr/zelytra/histeria/commands/inventoryLooker
p u m p
i check it out
ye
How can I put a player in Spectator Mode without them being able to fly through walls?
you can't, unless you manually check their position in every playermoveevent etc
you don't put it in spectator mod so
but in creative and invisible !
gamemod spec are client side not server side
Okay hmm
hm looks correct. did you properly save your config.yml file?
was a joke don't worry
nvm i forgot to save bruh
your code is your code
sorry
np it happens ๐
I want to make a spectator mode for my game mode. But if a player places a block and the spectator is with him, that doesn't work.
their si licens to protect it
placeBlock event canceled
stupid thing is that those leak websites ask money themselves for my work
no
and their buyers go to me for help
yeah but a person who releases plugins illegally doesn't give a shit about a license
does anyone knows if there is a way in intellij to replace all uses of a method to another method?
How do i customize max enchant levels with enchant gui?
1.17.1
yeah lmao
i agree this is internet
someone once started to sell my FREE plugins lmao
then I messaged him and he was like "oooh sorry I didnt know it must not do that blabla"
but you get like the first version
my AngelChest plugin was once leaked and they always released the newest version every time I updated it
ahhhh that's so annoying
then I added obfuscation etc and then it stopped lol
sooooo
I kinda think allatori does make sense, although of course it's not perfect
If the player in the creative is invisible and the spectator is in front of the player, the player cannot place blocks through the spectator
I just put the user in my code (doesn't even do anything) and they stopped
you can make it really "invisible" in client side look Player::setVisible
although I have no idea what the NONCE is for
:)
I mean I don't mind if they leak it for free
I'm fine with a free version that I don't have to give support to
but asking money themselves just nooo
well I kinda do mind. If they want to get it for free, they can ask me and I'll add them as buyer. What I don't want though is to lose control over who gets access for free
Nonce is the files download Id
yeah I know, but... how would it ever be useful?
depends how they ask it
pls
yeah true of course
if I get the standard my brother is sick just no
I don't really understand your question
On spigot... its only useful to the staff but they don't even allow you to use it as evidence.
or can I make a YT video in exchange for your plugin? bails
oh yeah makes sense
like I just imagine
someone leaks a plugin with their spigot ID in it, that could have been faked. but a matching NONCE and USER ID probably cannot jus tbe faked
exactly
I fill specific slots with heads for each player in a ArrayList and I want to fill the ones that are not filled with head to clear
I don't have access to my own leak though since I would have to pay xD
Can't be faked because no one can see anyone else's nonce
"I want to fill the ones that are not filled with head to clear" sorry I still don't get it
how can i do this?
it looks like this. In the line below the green wool I am filling each slot with a head from a player from the arrayList. But it varies how many players are in the arrayList.
The Problem:
I want to clear the slots that are left after I filled them with heads.
I hope you understand it now its hard to explain.
sorry I really don't get it ๐ maybe someone else understands?
Do you want to add glass panes to the rows when there's no heads left?
if so do a for loop with all inv slots and check if it's empty
Yeah kind of
Let me try that
IIRC getItem(int) returns Material.AIR instead of null, not sure though
soo check both, if the item is null or if it's type is AIR
just always null check when doing stuff with items
is there a real difference between for (object o : new object[] {...})
and Object[] objects = {...} for (object o : objects) {}?
not much reason to do either
quick question about custom enchantments
@NotNull
@Override
public EnchantmentTarget getItemTarget() {
return null;
}
it must not return null, but... that enchantment should work for ALL items and EnchantmentTarget.ALL is deprecated
what should I do? D:
(In all my plugins I simply return null and it never caused any problems but I feel like this is wrong anyway lol)
https://pastebin.com/bC75PV9W I want to do something in Intellij, but it doesn't work, why?
seems like you are using snakeyaml, but you're not using the version included in spigot, and also didnt shade it into the plugin yourself
can you show your code that's causing this?
this is my pom.xml https://pastebin.com/bntqJ0NL and the class https://pastebin.com/tTfK5rRZ
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
https://img.olziedev.com/QG655pR666555555XvIP.png i'm getting this error, anybody know why?
only on 1.17.1
ah nvm i found out why
is there a reason why you're still using NBT tags? PDC has been released in 1.14.1
hmm
can you post your code?
what's "profileField"?
hm I'm doing it the same way and it's working fine https://github.com/JEFF-Media-GbR/JeffLib/blob/99ff73309519559e180308479f0e2912daffa840/core/src/main/java/de/jeff_media/jefflib/SkullUtils.java#L70
try to use latest spigot and not paper and see if the error still occurs
sometimes paper has strange bugs in certain versions
oki
e.g. in paper 310 Command#getPermissionMessage always returned null, took me hours to find the problem lol
sooo better check it using spigot before we spend ages trying to find the problem^^
lmao
ok thankfully i had it already in build tools for 1.17.1
well i just realised i am using itemMeta, not skullmeta in my reflection
that could be why, maybe
oh yeah
doubt it though
use getField instead getDeclareField
getDeclaredField only returns fields that are defined by that exact class
getField returns all fields that are declared by that specific subclass
or super classes etc
hwo do i check if a player is banned?
OfflinePlayer#isBanned
I just checked my code again @chrome ferry , I'm using getDeclaredField on SkullMeta and it works fine in all versions
okay thank u, one moment
sooo either use SkullMeta, or use getField instead of getDeclaredField ๐
lol
laughs in 32 GB
I did a very bad job at building this PC
I cannot upgrade to Windows 11 because of missing TPM >.<
same
yeah I should have invested more into the mainboard
but I have no idea about building PCs sooo... I didnt know any better
Arbeit
Ethernet
yeah no idea why they didnt translate that
lmao
it should be called NETZWERK
btw @ancient plank somce you're already here
is it possible to convert a paid resource on spigot to a free resource?
idk
I don't use the forums
can probably ask for it to be moved
yeah I got some different answers from different people
and the forum staff haven't replied to my DMs ๐
or go for mcmmo setup both free and premium
yeah maybe, I haven't decided yet
You sure you don't just have it disabled?
Hi, how to get item from main hand?
bruh are you me?
Player#getInventory#getItemInMainHand
or are you on 1.8?
no i am 17
and my purple is a bit lighter than yours
hmm yeah, anyway thanks
1.8 and earlier it's Player#getItemInHand, 1.9+ is what I wrote above
be yourself man)
u mean the event?
?pdc
what do you mean?
Well like i have a onCommand boolean right now but i cant use an playerinteractevent inside of it
so people told me to create an listener
but idk if my listener is good + how i should call that event (.Java class) inside of my boolean
do you even know java
yes
do you know the naming conventions
yeah your naming scheme is cursed
owh ๐
what exactly are you trying to do?
Ok so, i want to check if the player has right click on a chest + he is sneaking. Well et cetera the end conclusion is that it for now will log the location.
Hey,
I am trying to use the mojang mappings with the maven plugin.
I am getting the error Failed to create remapped artifact, project main artifact does not exist.
Any ideas?
anyone know If I want to set a Inventory slot to nothing should I use null or Material.AIR ?
both work
thx
did you run BuildTools using the -remapping option?
and why can't you just check in your listener whether the player is sneaking?
I'd use null
and dont you need to input the mapped .txt etc. in the dependencies too
nope
oh, i had to do that
really? normally I'm using the obfuscated mappings but I once tried and the special sauce (lol) thing was enough to make it work
lmfao yeah
i mean
i spent like 3 hours trying to do
i aint gonna touch it, if it works. it works
I do (if(p.isSneaking()) { //ssss }
so why do you need the command?
Ye I did, and IntelliJ also found the remapped jar, so there are no errors highlighted
https://www.spigotmc.org/threads/spigot-bungeecord-1-17-1-17-1.510208/ I simply followed this guide
oh you are right, it indeed has a <configuration> thing that specifies the mappings file
I dont know what you mean ๐
I just copied that from md_5s post and changed 1.17 to 1.17.1, what exactly is missing there?
yep me too
but tbh I rather use the obfuscated mappings because otherwise it'll break on every update
doing it with the obfuscated mappings, I can just use reflection to use the correct fields / methods
Except those will change
that's why I use reflection
so I can decide on runtime whether "playerConnection" is called "a" or "c" or "blabla"
sorry but learn java
you need an instance of your listener
to call non-static methods
but tbh
you don't even have any event in the left class
soooo
what would you call that method with, anyway?
also pls stop naming your variables "p" and "e" etc, it's a very bad habit https://blog.jeff-media.com/give-your-variables-descriptive-names-ffs/ @fossil prawn
smaller field names mean smaller jars means speed ๐
Oh rly? I thought the mojang mapping names are pretty much consistent and won't change from update to update
yes, the mojang mappings are
buuut
when you compile your plugin, they get translated back to the obfuscated mappings
and those of course change all the time
that basically means you have to compile a different .jar for every MC release
which is why I don't use them
Ah right, I am only using it for my network which got one MC-Version for every spigot server anyway so the mojang mappings are pretty damn yummy for me
yep then you're lucky ๐
delicous
delicious*
I hate nexus. Why do I have to tell it the file extension of every file, like - why can't it just auto-detect it?! smh
I still didnt manage to get it working tho, might have something to do with my multi-module project?
Just created a fresh project to test this
sry mb
the tutorial worked fine for me, you might have to add it to every sub module pom maybe?
๐คฎ the word nexus gives me ptsd
if you know a better repo manager, pls let me know ๐
no no for other reasons
unfortunately not, already tried that
a server I play on, like 6 years ago, had a professions system named Nexus. It was the buggiest thing in the world, because it was written by epople who weren't that good at coding in 2011.
like 100k+ lines of code for a system which was shrunk down to like 10-20k lines when the system was remade
yeah some people think copy paste is a good idea when coding lol
Hello good morning, how do I upload a plugin to the spigot page?
believe it or not there's an add-resource button on the forums :)
add that to the list of useless tutorials I should make
๐
how do i set an item in anvil inventory?
like you do in every inventory
use Inventory#setItem(int, ItemStack)
when you .getBlock().breakNaturally(); to a chest is it not meant to drop all the contents? or will i need to get the inventory contents and drop those items? Just asking too make sure that it's not meant to drop the contents
alright, thank you
yeah thats fine, i just didnt want to accidently make a dupe thing
you can just do sth like this:
Chest chest = event.getBlock().getState();
chest.getBlockInventory().forEach(itemStack -> chest.getWorld().dropItemNaturally(chest.getLocation(),itemStack));
i've got this
for(ItemStack item : inventory.getContents()) {
if(item == null || item.getType() == Material.AIR)
continue;
location.getWorld().dropItemNaturally(location, item);
}
}```
yep that's basically the same
oh and yeah I forgot to null check in the example I sent
sooo yeah just use the code you just sent
thanks for your help
np
i did but the item is invisible
are you german? your name suggests you're german lol
can you show your code pls
yes
!pastebin
thaaaat should work fine
but it doesnt
it just doesn't show anything in the inv, right?
yes its there but it is invisible
how do you know that it's there when it's invisible?
i have an onclick event and if i click the slot the event fires
na sry i am not allowed
ok
oh yeah you're right, it also doesn't work for me
hm
strange
let me do some more tests
yeah it's really strange
package de.jeff_media.test;
import net.md_5.bungee.api.ChatColor;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.block.Chest;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.block.BlockBreakEvent;
import org.bukkit.event.block.BlockPlaceEvent;
import org.bukkit.event.inventory.InventoryClickEvent;
import org.bukkit.event.inventory.InventoryType;
import org.bukkit.inventory.Inventory;
import org.bukkit.inventory.ItemStack;
import org.bukkit.plugin.java.JavaPlugin;
import org.jetbrains.annotations.NotNull;
import java.util.ArrayList;
import java.util.function.Consumer;
public class Test extends JavaPlugin implements Listener , CommandExecutor {
@Override
public void onEnable() {
getCommand("test").setExecutor(this);
getServer().getPluginManager().registerEvents(this, this);
}
@Override
public boolean onCommand(@NotNull CommandSender commandSender, @NotNull Command command, @NotNull String s, @NotNull String[] strings) {
openFakeAnvilInventory((Player) commandSender);
return true;
}
private void openFakeAnvilInventory(Player commandSender) {
Inventory anvilInv = Bukkit.createInventory(null, InventoryType.ANVIL);
anvilInv.setItem(0,new ItemStack(Material.DIAMOND));
commandSender.openInventory(anvilInv);
commandSender.updateInventory();
}
@EventHandler
public void onClick(InventoryClickEvent event) {
System.out.println(event.getCurrentItem().toString());
}
}
and i can't find any solutuins online
it SHOULD show an anvil inv with a diamond in the first slot
but it shows an empty inventory. however when clicking the first slot, I get a PacketProcessingError and kicks the player, but the console correctly tells me that I clicked on the diamond
very strange
sorry I don't have any idea either
ok ty
maybe open a post in the forum
it seems like the client simply ignores the anvil inventories, which kinda makes sense, because everytime you open an anvil in vanilla, it's empty
ok
does anyone know whether a new resource gets approved faster when it's NOT obfuscated?
anyone know why this code yeets the thing only like 1 block with barely any velocity?
for(int i = 0; i < plugin.getConfig().getInt("throwpower"); i++) {
fb.setVelocity(look.multiply(plugin.getConfig().getInt("throwpower") / 5).normalize());
}
bruh discord destroys indents
?paste
discord doesn't destroy my indents :)
lucky
btw is there a way to get the nearby chunks near a player?
lol
like as a list
bruh
found it
is there a shortcut way to blocktype.equals(Material.slab) to check if it's any of the 'slab' blocks
im not seeing any but just asking before i do it the long way and specify every possible slab block
Make your own.
Make an enum, set or list of the slabs and check if that contains the blockType
blockType.name().contains("SLAB")
Could work but if you're really keen on performance and speed read my above message.
EnumSet at that point
Still a String#contains call is quite fast
and it sounds like premature optimization
this is a temporary fix until i can address an underlying problem anyways
im adding exceptions that will be ignored by the plugin until i can address the proper way to handle them later on
I'd simply check whether type.getName().endsWith("_SLAB")
mostly blocks that don't act normally, change coordinates, or inhabit more than a single coordinate at a time
+1 premature optimization is just ridiculous
if a computer cannot handle a few simple string comparisons you have a way bigger problem than your plugin
for example ChestSort sorts items by creating a string for every itemstack - never ever did I get a single report about ChestSort creating lags
How do I get the source code of my plugin?
@tender shard do you have any idea how i can find a solution for my anvil problem because forum threads need so long to be answered to?
it is better for performance to check for lets say .contains("DOOR") rather than specifying each Material door in a comparison list right
does anyone whether obfuscating a plugin will slow down it's aproval process?
sorry I have no idea
ok ty
erm no, the opposite is the case
Sorry, it's the first time I upload a plugin, where is it?
comparing enums is very fast. comparing their names or checking whether it "contains" a certain string is still very fast, but a bit slower than directly checking the enums
so using .contains("DOOR") would be worse for performance than having it check if the object .equals every single door and trapdoor material individually
yes
but
don't worry about it at all
the difference is totally irrelevant
alright just making sure
comparing strings is very very very fast. comparing the material directly would be a tiny tiny tiny tiny tiny bit faster
you really shouldnt care about the difference AT ALL
18 lines of code being faster than 1 just seems counter-intuitive but i get what you mean about the different methods to checking
enums can be compared using ==
for strings, java has to check every character individually
sooo yeah, just because the source is longer, doesn't mean the execution takes more time as well
right
but as I already said: you really do not have to care about this
just create a method like
create the plugin in java, more specific in eclipse and export it to a .jar file, and I don't know how to get the source code or how do I get it?
public static boolean isSlab(Material mat) { return mat.getName().endsWith("_SLAB"); }
the source code is all the stuff that you "wrote" by hand
sooo
the source code is your eclipse project
@tender shard do you know what UNSPECIFIC_META means?
yep sure
it's every ItemMeta that isn't a "specific" itemmeta
e.g.
@tender shard ill stick to what i'm doing currently only because the list of things im comparing is slowly going to get smaller as i implement the ways for the plugin to handle those block types im currently excluding w/ the comparison, but will keep doing that as a method in my head if i need to do this again in the future
thanks ๐
a diamond pickaxe has Damageable itemmeta
ah ok
a firework has FireworkMeta, etc...
and all other things have "Unspecific" itemmeta
like when you add a display name to a dirt block, you get an "unspecific" itemmeta
I mean it would be like the name of the java project file
I really don't get your question
like imagine
im so confused
you make a new eclipse project
and you save it in C:\Users\YourName\EclipseProjects\MyNewPlugin
then everything inside MyNewPlugin folder is your source code lol
yeah me too lol
@obtuse crane you're asking what your source code is, it's the code that you wrote to make the plugin do the things it does
for that reason and the source code that I must put is the name that I put it?
sorry I don't understand
@vagrant stratus does approval for premium plugins take longer when the plugin's code is obfuscated? sry for ping but I really wonder lol
hatebin lol
I mean the main?
@obtuse crane Is your plugin your first java project?
like for real, I don't understand your question
the source code is EVERYTHING you typed into your IDE
source code = everything needed to make a .jar out of the things you wrote
like
it's self explanatory
EVERYTHING you did to get a .jar file is the source code
I really don't understand how you wrote a plugin without knowing what "source code" means lol
I understand, so I have to copy all the lines of code that I wrote and put them on the spigot page where it asks me?
anyone know why this isnt working?
@EventHandler
public void onPlayerJoin(PlayerJoinEvent event) {
new BukkitRunnable() {
@Override
public void run() {
if(!event.getPlayer().isOnline()) {
this.cancel();
}
List<Block> blocks = getNearbyBlocks(event.getPlayer().getLocation(), plugin.getConfig().getInt("radius"));
Random rand = new Random();
Block block1 = blocks.get(rand.nextInt(blocks.size()));
Block block2 = blocks.get(rand.nextInt(blocks.size()));
block1.setType(block2.getBlockData().getMaterial());
block2.setType(Material.AIR);
System.out.println("Decayed");
}
}.runTaskTimer(plugin, plugin.getConfig().getInt("decaydelay"), plugin.getConfig().getInt("decaydelay"));
}
you turn it into a jar
it doesnt get to the decayed part
but I would advice just messing around a bit first before uploading something to spigot
it is already flooded with /spawn plugins
ig it thinks the player is offline but idk why
also when you make decaydelay a bit higher?
hmm should be more then enough
wtf
I literally have no idea what you're talking about
I think he thinks you have to put the code you wrote somewhere on the page and the page will export it for you or something
or he saw github links and thought it worked like that
erm ok wtf
cant get this to work
lol made it into a thread cuz i think we're gonna be here a while
any one know how to create an anvil input gui without any other plugins?
declaration: package: org.bukkit, class: Bukkit
InventoryType.ANVIL
declaration: package: org.bukkit.inventory, interface: AnvilInventory
Do you know which one of these belongs to the server? I managed to get it working finally
@tender shard he might be asking what youre supposed to put in the 'source code' field on spigot plugin submission
.
this works but the item i put in to be renamed is invisible and i cant rename it.
@obtuse crane if you are asking what to put here you are supposed to put a link to where your source-code can be found, usually a gitlab or github repo page, also it is not required and you don't have to include it.
and if thats not what you are asking then i really have no clue what you're asking w/ all due respect
that's what I wanted to know thank you very much 10/10
glad i could help
Should be the non remapped or remapped obf jar
?paste
?paste
my code is
@Override
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
if(label.equalsIgnoreCase("decayreload")) {
if(sender.hasPermission("decay.reload")) {
plugin.reloadConfig();
sender.sendMessage(ChatColor.GREEN + "Config reloaded successfully");
}
else {
sender.sendMessage(ChatColor.RED + "You do not have permission to use this command");
}
return true;
}
return false;
}
anyone know what this error is
it says this.plugin is null
Your plugin instance is null
idk how you are getting the plugin but it sounds like a bad idea
lol
@quaint mantle how? it just doesn't work?
?paste
https://paste.md-5.net/pideradeqi.cs
my code:
new BukkitRunnable() {
@Override
public void run() {
for(Player player : Bukkit.getOnlinePlayers()) {
List<Block> blocks = getNearbyBlocks(player.getLocation(), instance.getConfig().getInt("radius"));
List<Block> airblocks = getNearbyAirBlocks(player.getLocation(), instance.getConfig().getInt("radius"));
Random rand = new Random();
Block block1 = airblocks.get(rand.nextInt(blocks.size()));
Block block2 = blocks.get(rand.nextInt(blocks.size()));
block1.setType(block2.getBlockData().getMaterial());
block2.setType(Material.AIR);
}
}
}.runTaskTimer(instance, 20, instance.getConfig().getInt("decaydelay"));
for some reason it only happened when i set it to 1 tick
https://paste.gg/p/anonymous/4f7fd56523f746318ec848016543efe2
error:
cannot access org.bukkit.ChatColor
run some checks on the value of decaydelay
print it
ok
is it a runtime error or IDE error?
lol it just the error even though im printing
idk, its IDE error ig
@hasty fog why is my config messed up
is it something to do with my reload
its just plugin.reloadConfig()
My IDE also sometimes forgets that bukkit exists, I guess restarting the IDE didn't work?
leme try
nah
Did you change the value of decaydelay on runtime or is it in the file by default?
ah someone help me
https://paste.gg/p/anonymous/4f7fd56523f746318ec848016543efe2
error:
cannot access org.bukkit.ChatColor
If you're using gradle/maven, re-run your script for it to make it re-download Spigot
still same problem
is there a way of finding out why maven is excluding a jar from shade?
Alright so, I am trying to ride a normally not rideable entity
A cow.
However, It doesn't work and I don't get any errors.
And also yes I have ProtocolLib in my plugins.
How can I fix the SQLITE_BUSY thingy?
by not trying to manipulate it when it's busy ๐ค
It means you've got more than 1 connection open which isnt closing itself
How can I keep track of that?
So only 1 connection will be opened, or just open the connection all time without closing it.
Would using Hikari pool fixes all of that?
To create a menu i need use all Map Javadoc?
Wym?
how do you open your connection, and is it done multiple times
It is opened multiple times, I don't know what's the best solution.
Should I store the connection to a field and reopened them every 5 minutes or so?
you shouldn't really be opening and closing a connection unless it kills itself, if you wanna do it like that, use hikaricp, the problem is you're trying to do stuff with a new connection whilst the previous is still open without pooling which it doesn't like
Okay, so here's what I think right now.
Open a connection, store it on a field and do some things, and then when I want to do something with the database again, check if the connection that is stored on the field is closed or not, if closed open a new one, if not closed, use that again.
Yes do that
you might want to make the getconnection method synchronized so it doesn't run multiple times on different threads possibly causing the same issue, up to you
Here's the code, what do you think?
https://paste.md-5.net/ocagarivax.java
should be fine
probably not
I use it for stuff around that, not 100% sure if its needed, but it just forces methods to be run one at a time even with multiple accessing threads, its usually used when opening files, saving and closing etc
yeah for quering and commanding the db it might be good to have it in case u manipulate mutable data models
though you'd only bootstrap the actual database on one thread I hope
Alright, thanks so much guys.
How can I set yaw of an entity?
LivingEntity#setYaw
How do you download spigot? Is there a tutorial?
?bt
bump
send ur pom.xml
That doesn't work...
and btw Gradle
what entity are you trying to set the yaw of
and are you sure its pathfindergoals/ai arent just resetting it
if its a brainy mob
oh sorry
BoatyStuffAPI ๐ฎ
yes
It's just an Entity. Literally, the Entity class.
you cant instantiate an entity class, is it just a class reference or an actual instantiated object
discord shut up about threads istg
I am getting the entity from PlayerInteractAtEntityEvent
what entity are they interacting with?
Cows, Skeletons, Bees. Any entity, I am trying to set the entity yaw to the players yaw when the player is riding the entity
check if its an entity of LivingEntity, if so, cast it, then you can use .setYaw from the casted entity
getLocation first maybe?
ITS SET ROTATION
i tried getlocation too
iirc you also need to teleport the entity too after setting the yaw.
send code
?paste
any ideas?
^
oh something with packet, I don't know about that sorry.
Uhh
macho which one wasnt getting shaded?
BoatyStuffAPI
is it added to both compile time and runtime classpath?
u use intellij right?
yes
check if its added both under compile time and runtime dependencies
you use the maven tab insread
its there but its empty, then again, so is spigot so I dont think that matters, and gyazo just broke
I think seeing that is gradle specific
maven does have that
this is all thats under the maven project in that tab https://gyazo.com/3bc49f7d479f690b1ccf7f92506b7cca
gyazo started working again ๐
oh, yeah boatyapi doesnt have that which is most probably the cause
I think it should have scope compile?
I put that on to test it but it didnt seem to do anything, lemme try again see if it changes anything
with that it still doesnt say provided ;-;
well it shouldnt
oh
but I can tell u about runtime / compile dependencies if u want to have a further understanding
tho probably irrelevant
if it helps fix the issue then sure
but the classes of Boaty thing are present at compile time?
and reference the classes at compile time?
wdym
like can u import them in ur source?
yes
BoatyAPI has the main interface classes like DatabaseWorker, then the actual Boaty plugin has things that implement it
Like the Player interface to CraftPlayer
Its not another plugin, its just something that holds objects and interacts with Boaty
Yeah essentially
also for the maven shade plugin?
<include>com.machopiggies.boatystuffapi:*:*:*</include>
think it would only be com.machopiggies
since it includes a dependency right?
@fading lake
wdym? I thought if I didn't put its package name in itd just shade everything lol
idk but certainly the include tag takes a groupId, artifactId, version and snapshotVersion
similar to gradle
so you'd have to reference a dependency there, not a package afaik
but im nota maven expert so idk if this is case actually
ah nice
as did I, thanks <3
is there a way I can delete the drop that the player gets when they fish
declaration: package: org.bukkit.event.player, class: PlayerFishEvent
getCaught will return an Item in most cases
Hey, so I want to add a way to make it so players can't use TAB to get list of commands but idk how exactly I am going to do that
its not realllllllly possible since thats all dealt with on the client
you could cancel its packet, but idk how you'd do that
only works for tab completing an argument im pretty sure
probably yeah
No, it is possible, there are plugins which does that
decompile one ยฏ_(ใ)_/ยฏ
I am not allowed to decompile the plugin
They have no sourcecode provided either, that is actually a paid plugin but the free one doesn't support bungee
rules are made to break them
Especially in the EU
yes
Who said that?
i did
You should break this server's rules then
i don't feel like it
who cares lol, its only a crime if you get caught
Yeah exactly, same with me, I don't feel like breaking their rules
Sorry for the tag
If I had a reason to break them, like you do for learning how to do something, I would
this random topic change is interesting
I already know a plugin which does it but I don't have access to their source code
ctrl+f to find Tab-Complete (clientbound)
Tab-Complete (serverbound) may also be useful
client packet ids 0x11 and server packet 0x06 respectively
stop being such a pussy, nobody cares if you reverse engineer a plugin as nobody would know unless you said so
well it's dumb to be afraid of breaking arbitrary rules on a Minecraft plugin
It is not called being of afraid of
Reputation is a thing which I am sure you don't have any
the only way anybody'd find out is if you copied someone elses work line by line
And you should be muted for what you said
lmao
we could all just drop it and refer to the packet info I sent above
Also reputation can be both negative and positive, for me it's dependent on the person since some people are more assholes than others.
I'm just telling you to get off your ass and do it because nobody actually cares, besides, I've never given someone a list of the games I pirated back in the day, you don't need to announce that you decompiled something to learn a trick.
Knowledge should be unrestricted and free, so unless you can find a better way, learning from what others have learned is just plain better most of the time.
Anyway, that's all.
There are 2 approaches:
- Listen for outgoing completion packets
- Listen for the
TabCompleteEventand cancel it if your condition is met.
is a tabcomplete triggered when using console?
yes
yikes
and its horrible
selection in console is difficult
if you're just using cmd.exe there is no selection
For a peaceful creature to attack you, would it be something like that?
@EventHandler
public void Custom(CreatureSpawnEvent e) {
if (e.getEntityType().equals(EntityType.BEE)) {
Bee Animal = (Bee) e.getEntity();
Animal.setHealth(40);
Animal.setCustomNameVisible(true);
Animal.setCustomName(new ChatComponentText((ChatColor.GOLD +"Animal Hostil")));
public void initPathFinder() {
super.initPathfinder();
this.goalSelector.a(1, new PathfinderGoalNearestAttackableTarget<EntityHuman>(
this, EntityHuman.class, true));
this.goalSelector.a(1, new PathfinderGoalNearestAttackableTarget<Animal>(
this, Animal.class, false));
{
}
}
}
canceling tab complete doesn't really work
why not?
Its quite more complicated than that. The entitiy needs the proper attributes for attacks to be calculated.
How to hide entity for specific player without ProtocolLib or other dependency?
Packets. A whole lot of packets.
Specifically: Listening to packets
Tried sending entity destroy packet to player, doesn't work
If you dont want to use ProtocolLib then you need to inject your own packet handler into the netty pipeline.
Which is harder than using protocollib
the thing is with protocollib is that so many plugins use it that most servers will already have it installed
alright so protocollib is probs easier
cheers
there isnโt a whole tonne of documentation so you may have to just look at other plugins
Is there some kind of 'total amount of ticks' variable you can get from the server?
Trying to time some actions and ticks makes more sense then miliseconds
but don't feel like ticking down a single int each time
is bukkittask deprecated?
@gritty urchinno packet wrapper = ๐
you can shade packetevents for example
ez
How can a player place blocks in a player?
Shit, do you know how or something?
You should just use the bukkit scheduler in that case. The total amount of ticks is irrelevant if you only need a delta.
The total amount of ticks is relevant in this case. I have an action queue and want to store the time the last action took place, such I know when the next should start
The option with delaying bukkit tasks could lead to a chain of them and I am not willing to have that : $
Use a timestamp
Just do something like this then:
public class ServerTickTime {
@Getter
private static long current;
private static boolean started = false;
public static void start(final JavaPlugin plugin) {
Preconditions.checkState(!started, "Cant start this task twice.");
started = true;
Bukkit.getScheduler().runTaskTimer(plugin, ServerTickTime::increment, 1, 1);
}
private static void increment() {
current++;
}
}
@Override
public void onEnable() {
ServerTickTime.start(this);
}
Later:
long tick = ServerTickTime.getCurrent();
Probably going to use something like that yeah. But I thought the time was stored somewhere already ๐ฆ
It is but its not exposed
Kind of sad, such a usefull var
In all my years i have not needed that even once ๐
And i have done a LOT of stuff with scheduling
Eh there are multiple way to schedule chains I guess hahaha
I just like the method of keeping the time since the last action
Yeah but you only need the relative time to your last action, not relative to the toal.
Could probably do something with scheduleTaskLater() but that seems like more effort
Fair enough but I didn't feel like decrementing a variable each time :/
Yeah but I need ticks specific now hahaha.
I am just going to store ticks in the already ticking task
how am i supose to load and paste a schematic using FAWE? every tutorial is outdated, ive tried using https://worldedit.enginehub.org/en/latest/api/examples/clipboard/ and im getting this errors: Unhandled exception: java.io.FileNotFoundException ive also tried https://madelinemiller.dev/blog/how-to-load-and-save-schematics-with-the-worldedit-api/ and im getting the same errorUnhandled exception: java.io.FileNotFoundException
You sure you have the right file in place?
https://pastebin.com/dvWsa9Pk this is my code
Use the deprecated api
where would i find that? and are there any documents or anything?
So what you want to use is:
WorldEdit.getEditSessionFactory()
Then use getEditSession(Worldย world, intย maxBlocks)
Also when doing edits with FAWE make sure to call things async or server will crash
for what? what would i replace?
The newSession part
i dont see a newSession part?
Hm wait is this all your code? No paste part
Anyway this for your actual error. I'm just helping you paste stuff since you linked that guide
https://pastebin.com/YPWMKPDa this is my code, no errors but when i try to build with maven i get this error cannot access com.sk89q.worldedit.EditSession pom - https://pastebin.com/3UCVr2Lt
Oh and use getDataFolder instead of hard coding path
its only for my server so i dont realy see why id need to do that
Why not write better code when you can
because its easier ยฏ_(ใ)_/ยฏ
but if i didnt have worldedit on my server and used FAWE would it work?
how do i make text look like this
do 3 ` things
but it wouldnt work though?
can i ask sth
It will work
sorry to interrupt btw but im close to finishing my project and this is the last problem
Yeah just ask
import org.bukkit.plugin.java.JavaPlugin;
import me.Duckybrine.MobArmor.Listeners.listeners;
public class Main extends JavaPlugin {
private static Main instance;
public static Main getInstance{} {
return instance;
}
@Override
public void onEnable() {
instance = this;
getServer().getPluginManager().registerEvents(new listeners(), this);
}
@Override
public void onDisable() {
instance = null;
}
}```
?paste
Put code here
you send the link here
oh ok
rip something in my plugin crashed the server
What does your plugin do?
Are you stalling the main thread
no
?paste
Alright so what's the problem
You are running it on the main thread
XD
of course itโs gonna stall it
You canโt run stuff on the main thread
I meant like
You canโt run stuff like forever loops on the main thread
Or like IO operations or database operations
well where else will it run
Async
while true :kekw:
i just realized thats where i f'd up
lol
how did I miss that
idk
ok ill export+post code to github so i dont lose it again
i had to code everything from the beginning bc of some error
and not just those 30 lines
btw its in a runnable isnt that on another thread
Are you sure?
then send us full code
?paste
Is EntityPickupItemEvent triggered on Inventory.addItem()?
Your code doesnโt show that
You are running it on the main thread
runTimerTask runs it on the main thread
im getting this error https://pastebin.com/i6nvkFGb from this https://pastebin.com/Gbe9cxcd and yes the schematic file does exist in that path
@paper viper
Dude why
lol
declaration: package: org.bukkit.scheduler, class: BukkitRunnable
i replied to the wrong msg
Use completablefuture or use runTaskTimeAsync or whatever
Pulse is rude ๐
Yeah
Try using getDataFolder
does getDataFolder just get "plugins/" or "plugins/<plugin-name>"
Second
thx
i think its the latter
i got error chaos when i did the runTaskTimerAsync
if a library is licensed under LGPL3, can I package it with a premium plugin?
That means something is wrong in your code then lol
I'm thinking yes, but I'm taking a second look over the conditions
lol
don't run bukkit api calls in async
Asynchronous block remove!
Oh
I do hope you removed the while true loop
Yeah
Also do things sync
I didnโt see that you were modifying the world lmfao
destroyers of worlds
lol
Remove the while true loop
?
if you want to loop a lot (with a break) just run a for loop with like i < 1000
??
The issue isn't that it's sync or async. That task should be sync. That is fine
It's that you have a while (true) in there that never completes
lol
same error
Just bear in mind that async != faster. Just means you're not going to halt the main thread if something takes too long. Getting random blocks in a world around a player is not going to take long whatsoever. Your issue is the while loop not having a termination clause
Yes you return if some condition is met, but what if it's not met?
What if the player is falling from a high place and now all blocks around them are air?
Could you send the whole error
I am trying to use gson in my plugin but for some reason the gson library doesnt is the same as in my other projects and it asks me to decompile .class file. any ideas what to do?
NPE on edit session init. That's probably caused by the fact that "world" doesn't exist
Though even if it did exist, you'll get a ClassCastException because you can't cast from org.bukkit.world.World to com.sk89q.worldedit.world.World
yeah i realised that, i fixed that, but im still getting an error from line 48 which is try (EditSession editSession = WorldEdit.getInstance().getEditSessionFactory().getEditSession((World) p.getWorld(), -1)) {
That's probably caused by the fact that "world" doesn't exist
Oh you edited it
mb
You need to use the BukkitAdapter instead of casting

which is (com.sk89q.worldedit.world.World) ?
WorldEdit's got some methods to convert Bukkit worlds to WorldEdit's World wrappers
Actually, WE has a simpler way to get an edit session as well
WorldEdit.getInstance().newEditSession(world)
well i tried ``` try (EditSession editSession = WorldEdit.getInstance().getEditSessionFactory().getEditSession((com.sk89q.worldedit.world.World) p.getWorld(), -1)) {
ah
He's using FAWE that won't work
oic
you told me to use worldedit as my dependency
whcih im doing
but im using FAWE on my server
I know
?paste
Use the BukkitAdapter instead of casting
wdym by bukkitadapter?
You might want to lower that loop size
Usage would be
var weWorld = BukkitAdapter.adapt(bukkitWorld);
it works ๐ tysm
Damn itโs not like it already tells you
Lol
But perhaps if itโs empty message?
and how the player could send an empty message?
Not sure. You may want to look in the source code to check
sad
if someone passes null as an argument?
๐คก
Bukkit not null checking be like
xD