#help-development
1 messages ยท Page 494 of 1
yes
people taught be about "encapsulation" and I was like "well then i tmust be in the same package"
Yeah this is definitely the way
I need 6 plotsquared hooks too
It is
I'm literally part of your repo
(it's still the best ever death chest plugin out there ๐ )
never change a running system
can i have MagicMaterial.java
why not just use @Data
I don't remember if there was any reason
maybe, maybe not
but also, you gotta note
you chose the only class that was completely commented out
because MagicMaterial is it's own lib since at least 2 years now
choose another class pls
I wanna show off how weird my source can be but still achieve 1000+ buyers lol
ill take ItemManager
oh I gotta add that this is AngelChest 4, so it's like 2 years old
i cant even drive
How do I get the Lodestone Location? This code throws a error public Location getLocation(ItemStack item) { CompassMeta meta = (CompassMeta) item.getItemMeta(); return meta.getLodestone().getBlock().getLocation(); }
?notworking
"Does not working" is a useless statement. Please describe what exactly is not working, what you expect it to do, and what actually happens. If you get any console errors, also ?paste the entire stacktrace.
there are many issues with that
- Maybe the itemstack "item" is null
- maybe it's not a compass, so you cannot just cast it
- maybe getLodestone() is null
thats fun
- many more possible problems
Also lodestone is a location
mysql cant connect anymore
So location.getblock.getlocation is pointless
and that too, although this would not throw any errors, but it's pretty pointless ^
How I set the lodestone location and its still null? public void setLocation(ItemStack item, Location location) { CompassMeta meta = (CompassMeta) item.getItemMeta(); meta.setLodestoneTracked(true); meta.setLodestone(location); item.setItemMeta(meta); }
thats fucking fun
and that we don't know if you do not share the whole stacktrace
?paste the WHOLE stacktrace
probably got disabled because you got an abuse report, check your emails
oh
Wait, it said the location is null. How when it detects a lodestone location? public boolean isLodestone(ItemStack item) { CompassMeta meta = (CompassMeta) item.getItemMeta(); return meta.isLodestoneTracked(); }
well fuck you too oracle
I have asked for the stacktrace thrice.
Just run a VM on your computer
cant
Or use wsl
pc wont ever be online constantly
Does it need to be
no backups, no mercy. what did you expect from a "free" VPS tbh
and you didn't back them up?
i backed them up like 2 weeks ago
then you can go back there
i only lost the survival that i made with my friends a few days ago
"location" is null in line 48 in "Main"
sorry but you should have daily backups. Next time you'll know better
then it cannot happen again
I lost like 500gb of pictures and videos of young me once, since then I know that "no backups = no mercy" is always true
you can be glad it was only a minecraft server
why cant they have a way to remove resources from an instance
I said that above, I just wanted to set the lodestone location and get that location
dude because you didnt even pay for it
you got it for free
wouldnt they want the resources back?
they got it back, now that they kicked you out
then what is line 48 in Main?
ItemStack item = player.getInventory().getItemInMainHand();
ItemStack itemOff = player.getInventory().getItemInOffHand();
if( item != null && compass.isItemValid(item) ) {
if( compass.isLodestone(item) ) { location = compass.getLocation(item); }
player.spigot().sendMessage(ChatMessageType.ACTION_BAR, TextComponent.fromLegacyText(String.join(" ", Arrays.asList(
ChatColor.AQUA+"[Tracking Compass]",
ChatColor.GRAY+"World: " + ChatColor.WHITE + location.getWorld().getEnvironment(),
ChatColor.GRAY+"X: " + ChatColor.WHITE + ((int) location.getX()),
ChatColor.GRAY+"Y: " + ChatColor.WHITE + ((int) location.getY()),
ChatColor.GRAY+"Z: " + ChatColor.WHITE + ((int) location.getZ())
)) ));
}```
also what's the purpose in "setting in it, then getting it"? If yu set the location, why would you need to get it again?
that are like 10 lines
which one is line 48?
getEnvironment()
you mean the one where you output ChatColor.GRAY + "World" ?
Yes
as I said, "location" is null
what even is "compass"?
I don't see you declaring it anywhere
epic, get over it. you made no backups off the VPS you got for free for 4 weeks
i think it was the free credits i got
Its declared, just not in view due to being at top of the main under onEnable
yes, oracle is confusing
yeah well
but I cannot see it
so I cannot help you
ill set it up again later today or tomorrow
unless you show it
most likely on 2 instances bc thats what they give
maybe ill manage to not fuckup perms this time
why don't you just pay like 5โฌ per month for a proper VPS
i dont have the money to spend on it
a) id forget b) i only have like a tb to store stuff on my pc so i doubt that would last long
Well, lets say this. When I get the item using compass.getItem(), the compass works with the cords display and no errors. But soon as I run compass.setLocation(item), the display stops showing and my current log file floods
This is the function from compass
a) that's why you do it automatically
b) a terabyte is much
c) if you cannot handle to do backups, and cannot even pay 5โฌ per month for a proper VPS, then you just are not able to host a VPS. maybe go work a bit in your free time. sorry, but what am I supposed to say?
only love is free ๐ฅฒ
how would i automate local host backups tho, also too young to work, i could pay for a vps for a while i just have to get the cash onto my card
no, sorry but I'm tired of helping you. your "location" is cleary null. you haven't managed to tell me what "compass" is, although I asked that twice. it also took me three attempts for me to ask before you sent the original stack trace. I don't have time to ask thousand questions all the time. If I ask you "show code" or "send stacktrace", you should immediately send that, or not expect help from me. maybe someone else can help you, I hope you got a splendid day nonetheless โจ
okay last chance, send your WHOLE main class now
?paste
โจ
rsync
but yeah I know, backups are annoying
you just gotta set it up once and then you're fine, rsync, borg, rsnapshot, there's many ways
thanks, lemme see
we need to see "TrackingCOmpass" class too
is it possible to like have 2 "instances" but access them and use them like its 1, im guessing its like 2 vms
I only see that you access "compass.getLocation()" but I never see you declaring any location - you just create a new "TrackingCOmpass", that's it
public void blockBreak(BlockBreakEvent event) {
if (event.getBlock().getState() instanceof Sign) {
Sign sign = (Sign)event.getBlock().getState();
if (sign.getLine(0).equalsIgnoreCase(ChatColor.DARK_BLUE +"[Player2]") || sign.getLine(0).equalsIgnoreCase(ChatColor.DARK_BLUE +"[Player1]")){
try {
TimeUnit.SECONDS.sleep(1);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
Block block = event.getBlock();
block.setType(Material.OAK_SIGN);
//((Sign) block.getState()).setLine(0, ChatColor.RED + "LOCKED");
block.getState().update();
event.setCancelled(true);
}
}
}```
Since sign change event does not work for server created signs, how can I change the text for the newly created sign?
you never call "setLocation" on your cmpass
so it's ofc null
what did you expect the location to be?
how can i get the 0xAA0000 from this for example
sign change event only works if the player closes the sign editor as that is the only time the sign can change not counting plugins modifying it
is that a "bungee" or "spigot" color?
sorry but what is that
if( Arrays.asList(Action.RIGHT_CLICK_AIR,Action.RIGHT_CLICK_BLOCK).contains(event.getAction()) && compass.isItemValid(item) ) {
compass.setLocation(item, player.getLocation());
}
}
why are you creating a new list in every PlayerInteractEvent?
bungee chat color, java.awt.Color
yeah anyway, are you sure that it ever gets called?
does compass.isItemValid(item) ever return true?
erm what now - bungee color, or java awt color?
Its being called, I know. Like I said, on calling compass.setLocation(). Display stops showing and log file get flooded
how do you know it gets called?
the ChatColor class is bungee, the Color class in that is java.awt
dude, trust me, you never set the location to THAT compass object
otherwise it wouldn't be possible that it's null
it's also cleary obvious
this
is not the same "compass" that you instantiated in your other class
it's two different TrackingCompasses
oki from which do you need the hex string? the awt or bungee color from? or both?
I don't know if I can upload videos to this channel
Usage: !verify <forums username>
it only takes like 20 seconds
prob bungee, but both wouldnt hurt
ok lemme see
ok since every bungee chatcolor has an awt toColor() mnethod, I'll only look at that
gimme a sec
String hex = String.format("#%02x%02x%02x", r, g, b);
this shuold work fine
r, g,b is obviously the color's getR() etc
another, maybe fancier solution would to bitmask, or hwever it's called, it:
String hex = Integer.toHexString(color.getRGB() & 0xffffff);
doesn't matter whether the 0xffffff constant is left or right, btw
could also throw that into String.format("%6x" or sth btw
if I was you, I'd use this, because I'm sure that this will work
Lightning Strikes public void setLocation(ItemStack item, Location location) { CompassMeta meta = (CompassMeta) item.getItemMeta(); meta.setLodestoneTracked(true); meta.setLodestone(location); item.setItemMeta(meta); location.getWorld().strikeLightning(location); }
Its being called
MrNate, I will give you one advice, and it will truly solve your problem. The issue is, it will require you like 10-30 hours to understand it properly. Are you fine with that?
wait, I can try to break it down a bit, but that requires you to already know a bit of things I doubt you already know
it did, ty
wait, lemme do it the other way around. I will try to give you an example, then maybe we can break it down t o10 minutes
What you mean? I made the plugins[01:43:33] [Server thread/INFO]: Plugins (6): [0;32;1mMGN-FarmRod[0;37;1m, [0;32;1mMGN-PortableChests[0;37;1m, [0;32;1mMGN-Hammer[0;37;1m, [0;32;1mMGN-TimberAxe[0;37;1m, [0;32;1mMGN-Staging[0;37;1m, [0;32;1mMGN-Excavator[m
I will break it down for you as easy as I can
Please listen for 5 minutes
Imagine you have the following class:
public class Person {
public String name;
public Person(String name) {
this.name = name;
}
}
Now, you can always do new Person("mfnalex") to create a new person, that you probably already now, right?
I know, its like a Object
do you want it as a hex or int?
already answered lol
managed to do it with string.format and Color#getRed/Blue/Green
now imagine you have a class called "MyFirstClass" and you do this:
public class MyFirstClass {
private Person mfnalex = new Person("mfnalex");
}
you created a new Person there, his name is "mfnalex".
Now, you create a second clas, called "MyOtherClass":
public class MyOtherClass {
private Person mfnalex = new Person("mfnalex");
}
the "mfnalex" in MyOtherClass is a TOTALLY different person from the one you created in MyFistClass - do you undertsand this, and do you understand why this is the case?
ofc both have the "field name" mfnalex, and both the parameter "mfnalex" passed, but it's still two different objects - as you can see, it's also a "new" Person, hence the keywoard "new"
do you understand so far?
maybe one day you will be in need of my color compressor
wat
it converts 32bit colors to 8bit colors
Wait, the location is not being set on the compass in game
Person mfnalex1 = new Person("mfnalex");
Person frostalf = new Person("frostalf");
mfnalex1.kill();
// Frostalf is still alive
Do you understand this?
I mean, yo uhaven't really answered my question before
which is actually much more important
wait till they learn that 2 identical objects are not the same ๐
lol
I'm not making fun of them, everyone started one day lol
I do, I been programming since 2010. I still can detect what is in the DataContainer class due to ItemMeta
I am not either
that is not remotely your issue
I have tried to break things down for you, and asked you simple questions, you have not replied to any of them
you are on your own now - or at least, without me
I have spent like 20 minutes of my time to try to explain it to you, but you struggle to answer basic questions
I will block you now and wish you a nice day
oh and
?learnjava
Here are some links to get you started on learning Java:
- https://www.codecademy.com/learn/learn-java
- https://www.sololearn.com/learning/1068
- https://www.learnjavaonline.org/
- https://programmingbydoing.com/
- https://docs.oracle.com/javase/tutorial/java/index.html
The last one is the only official one, however some of those concepts assume that you already know a bit about programming.
I really dislike blocking people here but if you don't even answr my questions like "did you understand this", then I just cannot help
it seems like you have not understand basic principles about OOP yet, just read one of the tutorials listed above
Then what event can I use?
I need to change the sign text of the newly created sign
The ShapedRecipe#setIngredient method requires a shape to be already set, because it checks for the validity of the key.
This is currently not part of the javadocs of that class.
Where do i suggest that it should be added or should i just add it myself and make a pull request?
(Ping me in reply)
@tender shard You might not see this message but I wanted to tell you that setting setLodestoneTracked(false) from setLodestoneTracked(true) has worked. Same setup
if you want others to add that docs:
?jira
?contribute
You can find information about contributing to Spigot at the following links:
https://www.spigotmc.org/wiki/cla/
https://www.spigotmc.org/wiki/guide-contributing-to-spigot/
https://hub.spigotmc.org/stash/projects/SPIGOT/repos/craftbukkit/browse/README.md
https://hub.spigotmc.org/stash/projects/SPIGOT/repos/craftbukkit/browse/CONTRIBUTING.md
Anyone avalible to help?
im asking to ask because i dont want to repost a bunch of times as its annoying and redundant
If you have a question, please just ask it. Don't look for staff or topic experts. Don't ask to ask or ask if people are awake or available. Just ask the question to the channel straight out, and wait patiently for a reply. Make sure you use the right channel regarding the topic of your question. Create a thread in case the channel is already in use!
no, once again you missed the important part
that is where did you call that method on?
on one random object, that the other class has no clue about
maybe this will help you, but I guess not: https://blog.jeff-media.com/getting-your-main-classes-instance-in-another-class/
the principle is the same, though
An ass reason
I dont think so, anyways, there is a tad bit nicer way to put it lol.
ima come back later anyways
Well, its working now. And I know about that. If I be doing other stuff that does not involve ItemMetas like config objects, they be stored in the Main class and that will be accessed from any class. Like this line in my FarmRod source code ```public class Main extends JavaPlugin {
public List<FarmRod> farms = new ArrayList<FarmRod>(); public DataManager data;
public void onEnable(){
// Commands
//getCommand("test").setExecutor(new CommandTest());
new CommandManager("farmRod",Arrays.asList(
new CommandCrops(), new CommandAnimals()
));```
you have not understood anything from what I explained to you earlier
that's fine, but you also haven't read any of the java tutorials I sent you
and that's not so good
that's like trying to fly a plane without having understood how a plane works
you will be able to steer around a bit with an already flying plane, but you won't be able to even start the engines, nor will you ever be able to land one safely, unless you go through hours of reading
I'm a bit tired of trying to help people who just want an easy solution, without knowing the basics. It cannot work
the issue you have is obvious and I explained it to your many times, but you don't get it. But you also refuse to try to understand it and well then all we gotta is wait until you're a bit more desperate. If you're desperate enough, you'll learn the basics, then once you tried, feel free to hmu again
Well, setting setLodestoneTracked to false fixed my issue. You might be new to that method but if someone would tell me it needs to be false. I do know what you mean about planes, I learned all my programming from YouTube and Google. HTML, CSS, JavaScript, Jade/Pug, Less and all that I learned in the 10+ years
Are you trying to do di
?di
Guide to dependency injection: https://www.spigotmc.org/wiki/using-dependency-injection/
No, its not. Just me trying to replace my minimap mod to a waypoint plugin system
waypoint plugin?
I assume your talkinng about:
https://www.curseforge.com/minecraft/mc-mods/xaeros-minimap/files
none of those is OOP ig
he doesn't know what he's trying to do, that's the issue
@slim wigeon
After you breif me, explain to me what your trying to do
in one sentence
Yes, that is what I making. I don't need you to make or redirect any plugin. Yes, I talking about that plugin. My brother had the mod installed and it was slowing his computer down. Also, he would disappear from my minimap sometimes
Send me the link to the waypoint plugin and the mod in question, I think i know which ones your talking about but i could use confirmation
I not the creator of this plugin but what I making is https://www.spigotmc.org/resources/tracking-compass.79777/
I don't need help with the mod, this server is only for spigot plugins as you know
It will be helpful if i have all the info, you dont seem like you exactly know what to do, or atleast thats what i heard
Well, I know what to do. I don't know what is with that person but lets say he did not tell me what method to use and tell me its my class when I know its not
ima read up a bit on ur issue
maybe someone else will help you in the meantime
The issue is resolved
ill try and hopefully remember to get back to you
Oh
[Tracking Compass] Distance: 1324.3m X: 200 Y: 64 Z: -109
public void blockBreak(BlockBreakEvent event) {
if (event.getBlock().getState() instanceof Sign) {
Sign sign = (Sign)event.getBlock().getState();
if (sign.getLine(0).equalsIgnoreCase(ChatColor.DARK_BLUE +"[Player2]") || sign.getLine(0).equalsIgnoreCase(ChatColor.DARK_BLUE +"[Player1]")){
try {
TimeUnit.SECONDS.sleep(1);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
Block block = event.getBlock();
block.setType(Material.OAK_SIGN);
//((Sign) block.getState()).setLine(0, ChatColor.RED + "LOCKED");
block.getState().update();
event.setCancelled(true);
}
}
}```
The sign text is not changed when its recreated, its whatever the text was when you broke it
and no, the sign changed event wont work because it takes a really specific input
How do I get a sign at that position?
Oh, i think i know why
it gets the block data from the previous sign when it was deleted
but how do I get the updated sign?
i tried find block at position
I was told to do that by someone here, it for some reason recreates the sign when its deleted, i mean its a keystone for the code to work
^ here
Isnt that a item? im talking about it placing a block at that position
the position the sign was deleted
that part works, but the text change acts weird
if its not a oak sign, the text is empty, if its a oak sign, its the name of what it was before it, [player 1] or [player 2]
I ran the block.update
But how do i get the updated one
i have 2 issues i havent been able to solve, furnace recipes wont work, not sure why (line 740) and unable to disable recipes for items with specific namespaced keys (line 705)
https://paste.md-5.net/abumotasak.cs
any information on why that might be can help
new to this, i know its very messy
https://paste.md-5.net/igeqofokop.cs
I have a problem. I have a method which saves some data to a yaml file, and when I sout the data, config.getString, or send the message to the player of the data, it sends the correct data, but in the yml file, it is written as ''
what can be the cause of this?
Additionally, when the player joins the server, a boolean in the yml file should be set to true, and it isn't, even though the method is clearly being ran as the debug message is sent as it should
you need to call the save method
after your done with your changes
should fix your problem
class org.bukkit.craftbukkit.v1_19_R3.block.CraftChest cannot be cast to class org.bukkit.block.DoubleChest
public class DeathEvent implements Listener {
@EventHandler
public void onPlayerDeath(PlayerDeathEvent event) {
Player player = event.getEntity().getPlayer();
Location blockLocation = new Location(player.getWorld(), player.getLocation().getX(), player.getLocation().getY(), player.getLocation().getZ());
Location blockLocation2 = new Location(player.getWorld(), player.getLocation().getX() + 1, player.getLocation().getY(), player.getLocation().getZ());
Block block = blockLocation.getBlock();
Block block2 = blockLocation2.getBlock();
block.setType(Material.CHEST);
block2.setType(Material.CHEST);
Chest chest = (Chest) block.getState();
DoubleChest doubleChest = (DoubleChest) chest.getInventory().getHolder();
org.bukkit.block.data.type.Chest blockData = (org.bukkit.block.data.type.Chest) block.getBlockData();
org.bukkit.block.data.type.Chest blockData2 = (org.bukkit.block.data.type.Chest) block.getBlockData();
blockData.setType(org.bukkit.block.data.type.Chest.Type.LEFT);
blockData.setFacing(BlockFace.NORTH);
blockData2.setType(org.bukkit.block.data.type.Chest.Type.RIGHT);
blockData2.setFacing(BlockFace.NORTH);
block.setBlockData(blockData);
block2.setBlockData(blockData2);
List<ItemStack> inventory = event.getDrops();
ItemStack[] inventory2 = inventory.toArray(new ItemStack[0]);
doubleChest.getInventory().addItem(inventory2);
event.getDrops().clear();
}
}
import org.bukkit.block.Chest;
import org.bukkit.block.DoubleChest;
why am I getting this error
why are you casting in places that are not even required
I'm trying to put the item drops on the double chest because if I only use Chest some of the items will be gone
that doesn't explain the unnecessary casts
which parts are not required
pretty much all of it
I only got the problem when I tried to cast Chest to DoubleChest
(org.bukkit.block.data.type.Chest) these are necessary
since they are from different chest classes
You can't just cast the Chest instance to a doublechest if it isn't a double chest to begin with
oh wait, I'll try to cast after it becomes a doublechest
but, if it is a double chest to begin with, then start with doublechest
it works now
thanks
jree
Is there a way to spawn ITEMCRACK particle? I don't know how to set material of particle
Nms?
Particle p = Particle.ITEM_CRACK;
p.getDataType().something();
and then spawn it
i did it with packets
ages ago
Wow how can I learn nms
idk how it goes now
Its challenging
?nms
Thx let me check ๐ซก
what about this tho
what is the alternative for itemMeta.setDisplayName as it's deprecated
Itโs not deprecated in spigot
Youโre probably using paper, so you should ask them
Nope
If you intend for it to work on spigot - they contrary
Using the non-deprecated alternative would be a massive problem then
Though at that point you should be asking yourself what you are doing with the paper api
i guess paper wants ChatComponent instead of String and that's the only reason it's deprecated
cuz it's not in Spigot
thanks
and also, how can I check if the event.getClickedInventory() is the inventory I want? like a custom gui?
because getTitle doesnt exist anymore
Important to note that if you make that change your plugin will no longer be compatible with spigot servers
declaration: package: org.bukkit.inventory, class: InventoryView
you can have a custom holder
or inv view
or use the spigot resource
how do I use this?
nvm I think I know
Inv#getView()
bruh
hey guys
i once tried to make a lib for location maths
what can i actually add to it
for example i have a flatDistance method, which basically returns distance between two locations ignoring Y difference
can there be like any use to this shit
if not then what can i add instead
also should that be a Location wrapper class or a static util class or a class which extends Location
public void blockBreak(BlockBreakEvent event) {
if (event.getBlock().getState() instanceof Sign) {
Sign sign = (Sign)event.getBlock().getState();
if (sign.getLine(0).equalsIgnoreCase(ChatColor.DARK_BLUE +"[Player2]") || sign.getLine(0).equalsIgnoreCase(ChatColor.DARK_BLUE +"[Player1]")){
try {
TimeUnit.SECONDS.sleep(1);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
Block block = event.getBlock();
block.setType(Material.OAK_SIGN);
//((Sign) block.getState()).setLine(0, ChatColor.RED + "LOCKED");
block.getState().update();
event.setCancelled(true);
}
}
}
The sign text is not changed when its recreated, its whatever the text was when you broke it
Sorry for posting this here so much, if i should stop for awhile i can
why do you use sleep
Thats not affecting my issue
i tried with and without it
still have the issue
Erase what?
try catch block
I'd have to erase the sleep thing too, I know it runs even with sleep because I had a debug log after sleep and tried it, and it worjed
@EventHandler
public void onBreak(BlockBreakEvent event) {
Block block = event.getBlock();
if (!(block.getState() instanceof Sign sign)) return;
if (!sign.getLine(0).matches("text1|text2")) return;
event.setCancelled(true);
Bukkit.getScheduler().runTask(instancePointer, () -> {
block.setType(Material.OAK_SIGN);
// sign = (Sign) block.getState(); i don't know if this line is actually needed
sign.setLine(0, "text");
// sign.update(); and this one too
}, 1L);
}```
bukkit.getSceduler
hm
?
ima try it
whats instancePointer
your main class(extends JavaPlugin) instance
the current class im on, or just the main class
the one which extends JavaPlugin
i told ya
if you code everything in one class
then just use this keyword
Right, i have a event class and a main class, ima assume I need to use a dependency injection to get the main class over
even though the events are run in the event class
the fact that events run in a separate class doesn't mean you don't need the DI for using JavaPlugin features
free java lessons
I know i need DI
whats the type for a this
"Plugin this"
?
as a argument for DI
i don't rlly understand what you mean
can you show or stream
this always returns instance it's connected to(called in)
public SignEvents(FileConfiguration config, PluginLogger logger, plugin this) {
this.config = config;
this.logger = logger;
this.instance = t
}
What would the third argument look like
for DI
YourMainClassName randomVariableName
this.instance = randomVariableName;
i hate how this looks omg
yup
.
wdym ik di
and pls never call sleep on bukkit's main thread
Read the chat
well, asking for the type of variable is kinda sussy
is it <main instance>.plugin?
and making variable name a keyword also sucks
Aside from that little thing, ik di. I went over it here the other day
Well im no expert in java, actually, im a beginner
public SignEvents(YourMainClass inst) {
this.inst = inst;
this.config = inst.getConfig();
this.logger = inst.getServer().getLogger();
}```
and you actually don't know parameter passing
this.instance.plugin ?
just this.instance
The method runTask(Plugin, Runnable) in the type BukkitScheduler is not applicable for the arguments (Main, Runnable, long)
there is no .plugin field bruh
Thats the error i got
coding from memory
oh
you don't need 1L in the end
i'm dumb
i used runTask and not runTaskLater
i'm a ๐ฉ sometimes
free "how to forget spigot" lessons
zacken you want some
sheit
@topaz atlas is it wokin' now
[[1;31mERROR[m] [1;31m/C:/Users/(censored)/eclipse-workspace/onutillities/src/main/java/com/onutillities/Main.java:[19,40] constructor SignEvents in class com.onutillities.SignEvents cannot be applied to given types;[m
[[1;31mERROR[m] [1;31m required: org.bukkit.configuration.file.FileConfiguration,org.bukkit.plugin.PluginLogger,com.onutillities.Main[m
[[1;31mERROR[m] [1;31m found: org.bukkit.configuration.file.FileConfiguration,org.bukkit.plugin.PluginLogger[m
[[1;31mERROR[m] [1;31m reason: actual and formal argument lists differ in length```
I cant compile
due to a error
general 1
you cant stream here tho
ill be on mute
oh right
hi guys i am new
Location pos1 = new Location(Bukkit.getWorld("world"), 154, 95, 84);
Location pos2 = new Location(Bukkit.getWorld("world"), 152, 95, 86);
World world = pos1.getWorld();
Collection<Entity> entities = world.getNearbyEntities(pos2, pos2.getX() - pos1.getX()-1, pos2.getY() - pos1.getY()+0.5, pos2.getZ() - pos1.getZ());
I need to get all the entities present between these coordinates, (the function is located a repetitive task) the method I used doesn't work very well in fact I had to fix it myself, how do I do it?
anyone have an idea to hide 'Inventaire' txt with texture pack
currently i have set this texture on my menu
{
"providers": [
{
"type": "ttf",
"file": "minecraft:negative_spaces.ttf",
"shift": [0.0, 0.0],
"size":10.0,
"oversample":1.0
},
{
"type": "bitmap",
"file": "minecraft:font/menu.png",
"ascent" : 13,
"height" : 221,
"chars": [
"\ue300"
]
}
]
}
it's my font to add my menu
why not a bounding box
please explain yourself better
BoundingBox box = new BoundingBox(loc1, loc2);```
you could use a BlockIterator to trace between two points and fetch any coliding entities with those blocks
List<Entity> entitiesInBox = world.getNearbyEntities(box);```
Thats more a cuboid than between two points
he said between two coordinates
I assumed he wanted more of a ray
they are really between in every way
than a defined AABB
๐
@fluid river if I shouldnt use sleep in my code, how else can I have a delay?
is an entity 100 blocks above the lower point really "between" A and B?
Bukkit.getScheduler()#runTask(javaPluginInstance, () -> {})/runTaskLater(javaPluginInstance, () -> {}, delayInTicks)/runTaskTimer(javaPluginInstance, () -> {}, delayInTicks, repeatEachXTicks);
Didnt you say we needed to remove the timer
I think there is something wrong:
intellij: cannot resolve costructor BoundingBox(Location, Location)
that's just java stuff
sry my bad https://hub.spigotmc.org/javadocs/spigot/org/bukkit/util/BoundingBox.html#<init>(double,double,double,double,double,double)
declaration: package: org.bukkit.util, class: BoundingBox
The method runTask(Plugin, Runnable) in the type BukkitScheduler is not applicable for the arguments (Main, Runnable, int
no it has 4 bruh
What kind of trace do you need? all entities on a line between two points? or all entities in an area defined by two points?
that's a runTask
there is a runTaskTimer method()
the second one
.
BoundingBox box = new BoudingBox(loc1.getX(), loc1.getY(), loc1.getZ(), loc2.getX(), loc2.getY(), loc2.getZ());
List<Entity> entitiesInBox = loc1.getWorld().getNearbyEntities(box);```
There is a runtasklater method, should I use that?
yes, for delaying tasks on more than 1 tick
cuz runTask delays on 1 tick afair
runTaskTimer is repeating the same piece of code each X ticks until you explicitly define a stop clause
and has initial delay(delay before code is executed first time and the timer actually starts repeating)
i used:
BoundingBox box = BoundingBox.of(pos1, pos2);
Collection<Entity> entities = world.getNearbyEntities(box);
oh
there was an of method
i'm extra dumb today
sorry
you probably don't need to use Collection
Set or List implementations would be alright
However, you have been very helpful; I don't think I would have found this solution on my own.
you can also add a filter to that method and use Stream.map() after all operations
ez
you just type ?jd-s
and search for interesting things
all sollutions are there
tho
@eternal oxide are you free rn
I am now
is there a way to make a custom furnace recipe only work if an item has a specific namespaced key? as well as disable one?
look 1 message above
sorry for the ping, but it still doesn't go as it should, the rectangle is always shifted a bit and doesn't get the area well, this is the picture of the area:
I have to get the corners and get all the players inside, if they are there teleport them if not return
@fluid river
your loc1 and loc2 might be set wrong ig
can you describe what you actually trying to achieve
and attach some code
Location pos1 = new Location(Bukkit.getWorld("world"), 154, 95+0.5, 84);
Location pos2 = new Location(Bukkit.getWorld("world"), 152, 95+0.5, 86);
World world = pos1.getWorld();
BoundingBox box = BoundingBox.of(pos1, pos2);
Collection<Entity> entities = world.getNearbyEntities(box);
if (entities.isEmpty()) {
return;
}
for (Entity entity : entities) {
if (!(entity.getType()).equals(EntityType.PLAYER)) {
continue;
}
I saw that it wasn't working and wanted to try specifying as much as possible but to no avail
oh i'm sorry, i paste the worng code
entity.sendMessage(...)
entity.teleport(entity.getLocation().add(0, 0, -3));
you are moving all entities -3 blocks from where they already are on the Z axis
Yes, that is not the problem, the problem is the selection of the rectangle
what exactly are you trying to do? I can see you are finding all entities in an area (2 blocks)
rectangle selection is always moved 1 block further to the right or left and I don't understand why
your selected area (BoundingBox) is a 2x2
your screenshot inside that box is a 3x3
is it possible? i took the positions of the corners
Location pos1 = new Location(Bukkit.getWorld("world"), 154, 95+0.5, 84);
Location pos2 = new Location(Bukkit.getWorld("world"), 152, 95+0.5, 86);```
2x2
you also don;t want to be adding 0.5 to y
then I guess I didn't understand its operation,
I took the coordianates of the corners should take the whole 3x3
Location pos1 = new Location(Bukkit.getWorld("world"), 152, 95, 84);
Location pos2 = new Location(Bukkit.getWorld("world"), 154.9, 95.9, 86.9);```
Specifically, the corners of the 3x3 black
remember that 154 is the very corner. Doesn't cover the block
it works now, what exactly did you do? and why
each location is the corner of a Block. it doesn;t cover teh blocks entire surface
so 152 to 154 is actually 2 blocks + 1 pixel
152 to 154.9 is 3 blocks
or close enough
then 152 is just the angle, why didn't you add the .9?
in other words, pos1 does not need adjustment, pos2 does
yes, pos2 should represent the far right of a block. pos1 represents the far left
Why does Bukkit.getOnlinePlayers() return a Collection<? extends Player> and not Collection<Player>? Are there any classes extending Player I should be aware of?
Okay, thank you, really helpful
?paste
future proof
Why does the sign not change when clicked?
I see
@fluid river Are you avalible?
probably
add a debug sysout to each of your code blocks
you will find your String comparison is failing
All the code works until the Bukkit.getSceduler
No errors
it just isnt changing the sign
do you get teh message "You are now going to fight" ?
yes
you get it when player 2 clicks?
Oop, it only works when i name it player2
ooh
IM DUMB
You are improving, 2 days ago you were even worse ๐
CHILL
jesus
Im used to other languages
which is even worse than just starting out
why is java like this
Java is love
Sign newSign = (Sign) block.getState();
newSign.setLine(0, ChatColor.RED + "[Locked]");
newSign.update();```
How do I set the signs orintation to be what it was before it was destroied
Wait ima send the whole function
public void onBreak(BlockBreakEvent event) {
Block block = event.getBlock();
if (!(block.getState() instanceof Sign sign)) return;
if (!sign.getLine(0).equalsIgnoreCase(ChatColor.DARK_BLUE + "[Player1 Click]") && !sign.getLine(0).equalsIgnoreCase(ChatColor.DARK_BLUE + "[Player2 Click]")) return;
event.setCancelled(true);
Bukkit.getScheduler().runTaskLater(this.instance, () -> {
block.setType(Material.OAK_SIGN);
Sign newSign = (Sign) block.getState();
newSign.setLine(0, ChatColor.RED + "[Locked]");
newSign.update();
}, 2);
Bukkit.getScheduler().runTaskLater(this.instance, () -> {
Sign newSign = (Sign) block.getState();
newSign.setLine(0, ChatColor.DARK_BLUE + "[Player1 Click]");
newSign.update();
}, 64);
}```
any ideas what could cause this on plugin messages? (the prefix/suffix character, no idea what that is, but causes issues)
appears on nearly all messages
the BlockData
Works with signs right?
I'm making custom recipes but it didn't work.
What's wrong with my code?
This is a part of it.
ItemStack board = Items.boards("board");
int boards_count = 0;
int boards_count2 = 0;
List<ItemStack> props = new ArrayList<>();
switch (x) {
case 1:
props.add(new ItemStack(Material.BRICK));
break;
case 2:
props.add(new ItemStack(Material.STICK));
break;
case 3:
props.add(new ItemStack(Material.STONE_BUTTON));
props.add(new ItemStack(Material.POLISHED_BLACKSTONE_BUTTON));
break;
case 4:
props.add(new ItemStack(Material.STONE_PICKAXE));
break;
}
for (ItemStack p : props) {
for (int i = 0; i < 1; i++) {
for (int j = 0; j < 2; j++) {
if (i == j) {continue;}
ShapedRecipe boards_recipe = new ShapedRecipe(new NamespacedKey(plugin, Items.boards.get(x) + "-" + boards_count2 + "-" + boards_count), board);
String[] s = {" ", " ", " "};
s[i / 3] = s[i / 3].substring(0, i % 3) + 'B' + s[i / 3].substring(i % 3 + 1);
s[j / 3] = s[j / 3].substring(0, j % 3) + 'P' + s[j / 3].substring(j % 3 + 1);
boards_recipe.shape(s[0], s[1], s[2]);
boards_recipe.setIngredient('B', new RecipeChoice.MaterialChoice.ExactChoice(board));
boards_recipe.setIngredient('P', new RecipeChoice.MaterialChoice.ExactChoice(p));
Bukkit.addRecipe(boards_recipe);
boards_count += 1;
}
}
boards_count2 += 1;
}
}
What doesn't work
The recipe isn't added? Wrong result?
What
I put the material in the crafting table but nothing comes out.
I'm trying to make shapeless recipes.
?paste
you current code props will only ever have one ItemStack in it
Hello, I don't know why my code isn't working :
I want to implement 1.13-1.16 support to my generation code, but it doesn't generate any block :
https://paste.md-5.net/aginiziloy.java
GenNoteBlock :java public void GenNoteBlock(Block block, Instrument instrument, int octave, Note.Tone tone){ block.setType(Material.NOTE_BLOCK, false); try { NoteBlock nblock = (NoteBlock) block.getBlockData(); nblock.setInstrument(instrument); nblock.setNote(Note.flat(octave, tone)); block.setBlockData(nblock); getLogger().info(block.getX() + " " + block.getY() + " " + block.getZ()); } catch(ClassCastException err) { getLogger().info("Erreur de cast"); } }Registering :java event.getWorld().getPopulators().add(new OreGenLegacy(this, 1, 35, 10));
stop spamming
(I use for my coding spigot 1.19.4)
?paste
How have you tried to debug it?
I'll upload on it
Are you sure the code runs?
yes
the code runs
but the generator doesn't work
If not, I suggest you start with that and see where the code "stops working"
I've pasted my code here.
https://paste.md-5.net/vakiyepufo.java
Thank you.
(The board recipe works perfectly, but the boards recipes doesn't.)
how can I debug my plugin ?
Could just put a few sysouts here and there between if checks & loops
okay
Could you in short explain what the code is supposed to do?
(What you're trying to do)
I want to make some custom shapeless recipes including different boards.
The materials are 1 board + 1 specific item(which is defined in "props" list)
And in order to make it shapeless, I used two loop from 0 to 8 to add 72 recipe for each type of board.
What's a board?
Items.board is a List<String> including the names of the boards.
Items.board(int) is a function that returns an ItemStack of the board itself.
this is when I check the block, thinking about it, I certainly need to use LEGACY_BLOCK Material
And these items are something for further plugin functions.
So
Okay not sure I understand a 100 percent
But shouldn't you just be making this a shapeless recipe?
Since you're (I assume) making variations of the board
which can be mixed with a prop
to make another board
I am trying to a shapeless recipe, but I assume shapeless recipe doesn't accept custom items as the materials right?
Material can't be custom
so it doesn't
shapeless can take a custom ItemStack
Not sure if adding all possible permutations of the craft is a good idea
(it isn't)
Instead, listen to the craft event
and compare the items in the crafting grid to those required by your recipes
ShapelessRecipe using custom ItemStacks
https://hub.spigotmc.org/javadocs/spigot/org/bukkit/inventory/ShapelessRecipe.html
https://hub.spigotmc.org/javadocs/spigot/org/bukkit/inventory/ShapelessRecipe.html#addIngredient(org.bukkit.inventory.RecipeChoice)
passing in https://hub.spigotmc.org/javadocs/spigot/org/bukkit/inventory/RecipeChoice.ExactChoice.html
I had not noticed that
Yup
I'd try it though
Doesn't work
Here's a thread about it
Why would a ShapelessRecipe have an option to add a RecipeChoice if it can't use half of the options
what's the oncursor item
When you click on an item in the inventory
and pickitt up with your mosue?
aight
Does shpedrecipe have an amount limitation?
No, but for your recipes to support all possible permutations
would take up
let's see
about 72 different recipes
to account for all possible shapes in a 3x3 grid
and there's 8 kinds of it for now.
On the input or output?
input
And I'm planning to add 20 kinds of material for three tool parts to assemble a tool
So that's 20*20*20=8000 for each type of tools.
Is that too many?
pretty sure that for inputs, it always only uses 1 item
it does, there is no method to set a quantity
other than multiple items of the same type
Instead, listen to the craft event
and compare the items in the crafting grid to those required by your recipes
I've tried that before, but the items in crafting slots would double after I craft something.
So I changed to the method I'm using right now.
Then you did it wrongly.
java.lang.SecurityException: Invalid signature file digest for Manifest main attributes
at java.base/sun.security.util.SignatureFileVerifier.processImpl(SignatureFileVerifier.java:317)
at java.base/sun.security.util.SignatureFileVerifier.process(SignatureFileVerifier.java:259)
at java.base/java.util.jar.JarVerifier.processEntry(JarVerifier.java:321)
at java.base/java.util.jar.JarVerifier.update(JarVerifier.java:234)
at java.base/java.util.jar.JarFile.initializeVerifier(JarFile.java:767)
at java.base/java.util.jar.JarFile.getInputStream(JarFile.java:852)
at org.bukkit.plugin.java.JavaPluginLoader.getPluginDescription(JavaPluginLoader.java:153)
at org.bukkit.plugin.SimplePluginManager.loadPlugins(SimplePluginManager.java:136)
at org.bukkit.craftbukkit.v1_19_R1.CraftServer.loadPlugins(CraftServer.java:318)
at net.minecraft.server.v1_19_R1.DedicatedServer.init(DedicatedServer.java:222)
at net.minecraft.server.v1_19_R1.MinecraftServer.run(MinecraftServer.java:616)
at java.base/java.lang.Thread.run(Thread.java:829)
Hi, im having this problem if i put my plugin
??
im not sure why this happens or what is this error
when does it happen
no the server
so without your plugin server works fine?
yes
Can someone please help me?
Im trying to make a message when a player joines for the first time and the message should be in 3 lines, but the message is never getting send when a new player is joining the server
public void OnJoin(PlayerJoinEvent e){
Player player = e.getPlayer();
if (player.hasPlayedBefore()) {
e.setJoinMessage(ChatColor.DARK_GRAY + "[" + ChatColor.GREEN + "+" + ChatColor.DARK_GRAY + "] " + ChatColor.GRAY + player.getDisplayName());
}else{
e.setJoinMessage(ChatColor.DARK_GRAY + "[" + ChatColor.GREEN + "+" + ChatColor.DARK_GRAY + "] " + ChatColor.GRAY + player.getDisplayName());
e.setJoinMessage(ChatColor.WHITE + "NY" + ChatColor.BLUE + "SPILLER");
e.setJoinMessage(ChatColor.WHITE + "Velkommen" + ChatColor.BLUE + player.getDisplayName() + ChatColor.WHITE + "Du er nummer" + ChatColor.BLUE + "1" + ChatColor.WHITE + "Pรฅ serveren");
}
}```
have you registred the listner? or added implements Listeners
you are replacing the same message three times
you'd better set join message to null
and instead do Bukkit.broadcastMessage()
Yes i have
so use what NukerFall said
I dont understand, can you please explain a bit more?
e.setJoinMessage(null);
just do e.setJoinMessage(null)
in your else {} block
and use Bukkit.broadcastMessage(...)
And i should also replace setJoinMessage to Bukkit.broadcastMessage right?
and then java Bukkit.broadcastMessage("ChatColor.DARK_GRAY + "[" + ChatColor.GREEN + "+" + ChatColor.DARK_GRAY + "] " + ChatColor.GRAY + player.getDisplayName()");
No
if (player.hasPlayedBefore()) {
e.setJoinMessage(ChatColor.DARK_GRAY + "[" + ChatColor.GREEN + "+" + ChatColor.DARK_GRAY + "] " + ChatColor.GRAY + player.getDisplayName());
} else {
e.setJoinMessage(null);
Bukkit.broadcastMessage("");
Bukkit.broadcastMessage("");
Bukkit.broadcastMessage("");
}```
Ah, i see. Well doesnโt newline work in join message?
idk lol
but the guy just used setJoinMessage three times
that definitely doesn't work)
Somehow I solved my problem, thank you guys!
Its saying Cannot resolve symbol 'Bukkit' 3 times at the Bukkit.broadcastMessage
Here are some links to get you started on learning Java:
- https://www.codecademy.com/learn/learn-java
- https://www.sololearn.com/learning/1068
- https://www.learnjavaonline.org/
- https://programmingbydoing.com/
- https://docs.oracle.com/javase/tutorial/java/index.html
The last one is the only official one, however some of those concepts assume that you already know a bit about programming.
I know i need to import it but i dont know what i should import? i have tried to import org.bukkit.event.broadcastMessage;
is there any way to remove all namespacedkeys from player's persistentcontainer that is from a specific plugin?
are you using intellij?
Yes but i have fixed it ๐
Do you have any tricks to know the imports? or what i should call it, so you easyly can see what the import is?
Eclipse? CTRL + SHIFT + O
Thanks
Im sorry for mentioning you
But its not working, when a player joines for the first time its not getting broadcasted
Code:
import org.bukkit.Bukkit;
@EventHandler
public void OnJoin(PlayerJoinEvent e){
Player player = e.getPlayer();
if (player.hasPlayedBefore()) {
e.setJoinMessage(ChatColor.DARK_GRAY + "[" + ChatColor.GREEN + "+" + ChatColor.DARK_GRAY + "] " + ChatColor.GRAY + player.getDisplayName());
if (player.hasPlayedBefore()) {
e.setJoinMessage(ChatColor.DARK_GRAY + "[" + ChatColor.GREEN + "+" + ChatColor.DARK_GRAY + "] " + ChatColor.GRAY + player.getDisplayName());
} else {
e.setJoinMessage(null);
Bukkit.broadcastMessage(ChatColor.DARK_GRAY + "[" + ChatColor.GREEN + "+" + ChatColor.DARK_GRAY + "] " + ChatColor.GRAY + player.getDisplayName());
Bukkit.broadcastMessage(ChatColor.WHITE + "NY" + ChatColor.BLUE + "SPILLER");
Bukkit.broadcastMessage(ChatColor.WHITE + "Velkommen" + ChatColor.BLUE + player.getDisplayName() + ChatColor.WHITE + "Du er nummer" + ChatColor.BLUE + "1" + ChatColor.WHITE + "Pรฅ serveren");
}
}
}
Dit else statement vil aldrig blive kรธrt fordi du tjekker om spilleren har spillet fรธr du tjekker igen.
Tjek dine scopes (brackets)
Sry fatter det ikke helt, hvad er det jeg skal รฆndre ved else?
Oh man good thing optic isn't on or you guys would be dead
Fjern dit fรธrste if statement og den anden sidste bracket.
Donโt worry
Please read the rules: http://j.md-5.net/1ikUQuU
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
Anyone have the auto-upload sftp gradle script
Smh
No hablo Ingles que es reglas
My typing often wouldn't qualify as English
Ahg
Hello, I want to store custom data in a block.
I made this, but it's not the correct syntax.
I followed the guide and I don't understand ๐คทโโ๏ธ
PersistentDataContainer customBlockData = new CustomBlockData(block, this);
NamespacedKey key = new NamespacedKey(this, instrument + " " + octave + " " + tone);
customBlockData.set(key, PersistentDataType.STRING, Math.PI);```
you create the key, so "data", then asign the instrument + octave + tone to it on the string
but this is not the correct syntax, that's the problem
I made thisjava PersistentDataContainer customBlockData = new CustomBlockData(block, this); NamespacedKey key = new NamespacedKey(this, "instrument"); customBlockData.set(key, PersistentDataType.STRING, instrument + " " + octave + " " + tone);
are those valid placeholders
How can i pass the onDisable to a method that requires PluginDisableEvent?
the ones that are not with a
I am aware of that
But if it requires a Comsumer<BukkitTask> how do I provide it a class
use a lambda
() -> {} just this
you can just use extends BukkitTask call a new instance and run it
extends BukkitRunnable
and then it should ask to create a
@Override
public void run() {}
no
either u implement Consumer<BukkitTask>
then just do this on where you need it
ClassName class = new ClassName().runTaskTimer() or what you need
or u extend what ZeroTwo said
he wants to create a new class for that
Any preference ?
BukkitRunnable
do it async, if you need to cancel entity or block do it in sync
Is posible to do placeholders which allow params let say, im trying to create them using Papi
At the momment none can explain what i really want
You can use Papi api
Yes im using it, but i dont know how to create placeholders which require arguments
if you want i can give you a code that uses a parameter like %help_idk_Playerinpt%
oh ok let me grab it
no
only async if needed
dont use async for the sake of async
why, if you running async code, you should catch it async too?
thats gonna end up breaking shit
I sync that section
I mean that if code is async, you must get the result async too
Yup
naa
I've seen that happen
naa
Alright, thanks a lot
try {
} catch (ConcurrentModificationException ignored) {}
``` 
How you make that on java, without blocking the whole app?
๐
I mean is there any await system simpler as Javascript one?
java is a bit more complicated lol
but its quite the same as Promises in js
That why i was wondering to know if there is any lib for working with async and sync, easier. Because java sucks, has things of things which make your head explode with too many things
String[] strings = s.split("\\}_", 2);
strings[0] = strings[0].substring(1);
strings[1] = strings[1].substring(1, strings[1].length() - 1);
String user = PlaceholderAPI.setPlaceholders(p, "%" + strings[0] + "%");
OfflinePlayer player = user.contains("%") ? Bukkit.getOfflinePlayer(strings[0]) : Bukkit.getOfflinePlayer(user);
String placeholder = PlaceholderAPI.setPlaceholders(player, "%" + strings[1] + "%");
if (placeholder.startsWith("%") && placeholder.endsWith("%")) {
placeholder = strings[1];
}
String Placeholder = PlaceholderAPI.setPlaceholders(player, placeholder);
if(Placeholder.equals("gang_name")) {
return "No Gang";
}
return Placeholder;
%bo_{ajlb_lb_gang_value_1_alltime_name}_{gang_name}%
This is what i made
Oh really thanks man, i was expecting to do that
just tweak it for what you need
Creating placeholders which require arguments, for them returning some data - exatly what u hv sent
javas concurrency std lib
thats the lib name right? also sorry for tagging. I really expect shity discord to disable the tag thing permanent
How can i pass the onDisable to a method that requires PluginDisableEvent? if someone knows the answer because im loosing my mind
no the standard library I meant
like java sdk
your question doesn't make much sense
oh java concurrency by defualt sucks, too many work for achiving async - that why iwant somethign easier
i repost my problem
i have that on my texture anyone have an idea to remove or hide it please ?
yeah thats the thing, doesnt someone already created that? So you dont lost hours of shity java async and use plug-in thing to lost less time?
i have a method that needs PluginDisableEvent and should be called on onDisable but passing it doesn't work
just use invisible character i think should work or add a space
Plugin disable event is an event which runs when a plugin gets disabled, you don;t call it from onDisable
ok thanks
your logic goes in onDisable
mmmm but if i use it this effect touch all Invenotry ?
which you can call from anywhere
no only your custom gui, if you are using one
verano
generally java needs more work since its a bit less abstract than js
regarding os threads, mem modeling and stuff
it does not come from the mistletoe itself I will not know how to explain it basically there is the inventory to create 54 slots and inside there is the name of the global inventory
and player inventory
but the title of this player inventory is not editable
You mean player inventory, then just modify it in the .lang
yeah i seen that, but is there any library for investing less time while working with async tasks?
thx you too for your help
I thought was for a gui, not for the player inventory
Something similar to how JDA works, where the things are async just adding the .queue() at the end of the method let say
// For example
webhook.send().queue();
@ivory sleet
does anyone know the best resource for mysql/hikaricp?
What do you mean with resource? A wiki about them
there's a few things on the wiki like https://www.spigotmc.org/wiki/connecting-to-databases-mysql/ but it does not use hikari
Also mysql and hikariCP are different things, HikariCP is a database pooling thing
i know i mean to use them together
oh right, i mention because most people refer them as the same thing
thats CompletableFuture
Anyone here worked with massivecore
right, but its not exactly what i look for. but i appreciate your answer
How can I make a gradle task run another task before but the previous task isn't explicitly added in build.gradle
Does anyone know how to update a player's position internally using ProtocolLib? I'm currently sending a ENTITY_TELEPORT packet to all nearby players to indicate that my entity has moved, but I also want the server to reflect these changes. I can't use Bukkit's API because I'm doing it outside of a server's tick.
iirc just ad task1.shouldRunAfter task2
if you are moving outside the tick the client and servers idea of where the entity is will always be out of sync
Hello, when I use this method, I never get the text in the console (getLogger().info(block.getX() + " " + block.getY() + " " + block.getZ());)
Is there something wrong ?
public void GenNoteBlock(Block block, Instrument instrument, int octave, Note.Tone tone){
block.setType(Material.NOTE_BLOCK, false);
NoteBlock nblock = (NoteBlock) block.getBlockData();
nblock.setInstrument(instrument);
nblock.setNote(Note.flat(octave, tone));
PersistentDataContainer customBlockData = new CustomBlockData(block, this);
customBlockData.set(new NamespacedKey(this, "instrument"), PersistentDataType.STRING, instrument.toString());
customBlockData.set(new NamespacedKey(this, "octave"), PersistentDataType.INTEGER, octave);
customBlockData.set(new NamespacedKey(this, "tone"), PersistentDataType.STRING, tone.toString());
block.setBlockData(nblock);
getLogger().info(block.getX() + " " + block.getY() + " " + block.getZ());
}```
Any way to flag so that a Minecart does not derail no matter angle/velocity?
right, but i'd like to update the location when it's back in sync without teleporting the player. Entity#teleport calls an event which is what I'm trying to avoid
from what I know minecarts only derail when they run out of rails, you need to check that for yourself
where is GenNoteBlock called?
Yeah I have overwritten the max velocity for a minecart so that's why it goes over during the turn
I see
like it just derails at the turn?
im afraid there is nothing built-in that can help you
if you just boosted the minecart velocity, you are on your own as that is pretty much undefined behavior
Yeah exactly, hence why I'm reaching out for help. Thanks though, then I have it confirmed!
okay
have you checked if the function rusn at all?
overworld_materials probably doesnt contain what you need
yes, it runs at all
oh
it contains
How do i get the total of all joined player's?
I want to make so when a new player joines for the first times it says You are number (number of all joined player's) joined on this server
From what version, we get deobfucation?
maybe try Bukkit.getLogger instead?
there is bukkit.getLogger()
yes just type Bukkit.getLogger
From interface: org.bukkit.plugin.Plugin
the problem comes from what there is upper
customBlockData.set(new NamespacedKey(this, "instrument"), PersistentDataType.STRING, instrument.toString());
customBlockData.set(new NamespacedKey(this, "octave"), PersistentDataType.INTEGER, octave);
customBlockData.set(new NamespacedKey(this, "tone"), PersistentDataType.STRING, tone.toString());```
when I added this, my code stopped working (for the method)
0 errors
well that wouldnt prevent the text from logging I assume
Maybe get offline players
this prevent the text from logging x)
no problem
I assume the data also doesnt get set?
Idk
because the method doesn't work
that can't be, unless you got some error that you ignored
nothing :/
also no warnings?
no errors
no warnings : nothing
btw, first of all "GenNoteBlock" is a bad method name. Second, when/where do you even call this method?
the method doesn't work when I add java PersistentDataContainer customBlockData = new CustomBlockData(block, this); customBlockData.set(new NamespacedKey(this, "instrument"), PersistentDataType.STRING, instrument.toString()); customBlockData.set(new NamespacedKey(this, "octave"), PersistentDataType.INTEGER, octave); customBlockData.set(new NamespacedKey(this, "tone"), PersistentDataType.STRING, tone.toString());
I call it from here :
#help-development message
who is registered with this :java @EventHandler public void onWorldInit(WorldInitEvent event) { getLogger().info("World init"); event.getWorld().getPopulators().add(new OreGen(this, 1, 40, 15)); }
the problem come from GenNoteBlock
@tender shard
paste your whole log please. I can't believe that you don't get any error message
weird. you should get an IllegalStateException when calling getBlock() on the blockstate
I get nothing x)
it works
wdym
but it doesn't work when I add the code
no errors, getBlock() on the blockstate works
but the method doesn't work when I add this #help-development message
print out what it returns in the line directly before the one you use new CustomBlockData(...) in
are players potion effects saved during restarts?
CraftBlock{pos=BlockPosition{x=75, y=18, z=-345},type=NOTE_BLOCK,data=Block{minecraft:note_block}[instrument=harp,note=0,powered=false],fluid=net.minecraft.server.v1_14_R1.FluidTypeEmpty@e70f13a}
What am i going to write in the text? there is nothing called something with amount
@tender shard
.length
String msg = "you are player " + Bukkit.getOfflinePlayers().length + " on this server.";```
what exactly is not working
what about .clone() if it's a copy hm?
freejavalessons
?jd-s
good luck
lol
you just ?ask
wait 4 me
well there is no spigot course
1 day
this was 1.5.2 version
so api was quite easy
well less then a month
surely
@tender shard java public void GenNoteBlock(Block block, Instrument instrument, int octave, Note.Tone tone){ block.setType(Material.NOTE_BLOCK, false); NoteBlock nblock = (NoteBlock) block.getBlockData(); nblock.setInstrument(instrument); nblock.setNote(Note.flat(octave, tone)); PersistentDataContainer customBlockData = new CustomBlockData(block, this); // Bug here customBlockData.set(new NamespacedKey(this, "instrument"), PersistentDataType.STRING, instrument.toString()); customBlockData.set(new NamespacedKey(this, "octave"), PersistentDataType.INTEGER, octave); customBlockData.set(new NamespacedKey(this, "tone"), PersistentDataType.STRING, tone.toString()); block.setBlockData(nblock); getLogger().info(block.getX() + " " + block.getY() + " " + block.getZ()); }
depends
i mostly just throw big plugins
not cuz they are too hard
i'm just too lazy
if i'm under pressure i can code it in several days
.
i mean
i can explain the api in like several sentences
in english you say