#help-development
1 messages Β· Page 1683 of 1
Hello @waxen plinth .
In RedLib, is there a technical limitation that explains why ItemUtils and ItemStackBuilder Constantly returns new instances instead of modifying current item ? Or is it simply a choice you made ?
<plugin name>Plugin
I call it pluginname
maybe make an issue if you can be bothered then https://github.com/minecraft-dev/MinecraftDev/issues
It's gonna be TutorialPlugin
I've never used the plugin and never will so not my job
neither
I use Eclipse
There's no technical limitation or anything
But it's so that you can do stuff like this
True means I placed the block and it gets tracked however when I break the block it's not tracked anymore? is the PlayerBlockTracker plugin failing?
even ms-paint IDE is bette
My installed jdk jre thing in my plugin is jdk-16.0.1 and that is the highest java version I have installed. Does that mean I have to change my server version?
ItemStack item1 = new ItemBuilder(blah).blahblah().blah();
ItemStack item2 = ItemUtils.rename(item1, "thing");```
i use intellij but the plugin literally broke my ide when i installed it years ago, so i never used it again
I do not remove the track anywhere
If you build against 16 your server has to run that too
thanks spigot for your raytracing detecting Player
below 1.17 is 8 above is 16
I get that making new items each time wastes some memory but it's never caused any issues so I won't prematurely optimize
That being said I have never actually used it in this manner
check if player is in the raytracing then do stuff?
I sort of just expected I might have to lol
ehh
I can switch it over if you have qualms with it
Ah ok thanks
like clicking on it detects itself
But it wouldn't make that much of a difference to be honest
getItemMeta creates a new instance every time
ItemUtils would still be about as wasteful, you could preserve the ItemMeta with the builder I guess but I've never seen anyone have issues with the performance of creating items
I never use ItemStack
π€
I use an ItemBuilder
guess what that uses
Yes we're talking about my library's item builder here lmao
oh
Thank you for your contribution
sorry
I see. Thank you for your answer
In fact changing that would not only be for optimization reasons. In some cases we need to modify the current ItemStack. Doing so avoids having to replace it in the player inventory by some modified clone. It can be nice to make the code shorter and cleaner.
Also, the ability to chain builder methods does not rely on recreating object. For example:
ItemBuilder setName(String name) can both modify the name of the ItemBuilder (ItemBuilder = ItemStack) without creating a new one and, in addition, returns the same ItemBuilder.
I think that too. But don't do it for me. I had to extract and include that part of your lib in my project (since I did not want the whole lib for my needs) so I don't need it myself.
It can be shaded, you know
Yeah but I want to avoid have things unrelated to items management in my item management lib.
Ahh, you're making a library of your own
That makes sense
By the way, I have a support discord you could join, would probably be a better place to ask these questions
That lib contains some particular things (translation, ability to add events with conditions/actions on items, ...)
Actually come to think of it, setItemMeta would need to be called every time via ItemBuilder since there is no build method to end the chain
Ok then send me the link privately if you want ^^
So I'm not sure there would be much of a point to making the ItemBuilder retain it
how can i detect when a player jumps?
You can't, not directly
Well actually I think there might be a stat for it but that's provided by the client if I recall
Can be spoofed
let me find a code extract
i know paper has its own jump event, but im trying not to use it
Umm?
Ambiguous plugin name `CreeperSpawn' for files `plugins\CreeperSpawn2.jar' and `plugins\CreeperSpawn.jar' in `plugins'
custom range is definitely possible π€
@EventHandler
public void onMove(PlayerMoveEvent event) {
Player player = event.getPlayer();
/* Check that:
- positive vertical velocity (avoir ladder case)
- Not swiming or jumping out water
- Not flying
- Checking that player actually gone up during this move
Will be true if the player jumps or if he is sent up by explosions.
*/
if (!player.isOnGround &&
player.getVelocity().getY() > 0 &&
!event.getFrom().getBlock().isLiquid() &&
!player.isFlying() &&
event.getFrom().getBlockY() < event.getTo().getBlockY()
) {
//...
// On jump ...
}
}
@ember crag
Wouldn't that fire multiple times per jump
if !player.isOnGround
^
Pretty sure that would trigger with auto step enabled
it may fail on teh velocity though
hmmm. I hadn't the problem but in the context of my needs I suppose it wasn't an issue.
Don't hesitate to share a better code extract :/
I'm learning how to make plugins and when exporting I get this error message: ```JAR creation failed. See details for additional information.
Resource is out of sync with the file system: '/plugin/src/plugin.yml'.
Resource is out of sync with the file system: '/plugin/src/plugin.yml'.
If Eclipse press F5
About that, don't save itemMeta in builder. Just make ItemUtils modify the current ItemStack instead of creating a new one. It will be easier and since, as you said, ItemCreation will not cause too much slow down issue, you don't need to avoid itemMeta cloning.
Anyway I will do the modification on my side and send you the files back. It have some diffs with your original classes so you will not be able to include it easily but It may still be quicker than doing it yourself ^^
I also completed ItemStackTrait
I got this error message when starting my server, I don't know what part of it is important but here: [20:28:38] [Server thread/ERROR]: Could not load 'plugins\plugin.jar' in folder 'plugins' org.bukkit.plugin.InvalidPluginException: Cannot find main class `com.CJendantix.plugin.Plugin' at org.bukkit.plugin.java.PluginClassLoader.<init>(PluginClassLoader.java:69) ~[spigot.jar:3231-Spigot-3c1fc60-e167f28] at org.bukkit.plugin.java.JavaPluginLoader.loadPlugin(JavaPluginLoader.java:145) ~[spigot.jar:3231-Spigot-3c1fc60-e167f28] at org.bukkit.plugin.SimplePluginManager.loadPlugin(SimplePluginManager.java:394) ~[spigot.jar:3231-Spigot-3c1fc60-e167f28] at org.bukkit.plugin.SimplePluginManager.loadPlugins(SimplePluginManager.java:301) ~[spigot.jar:3231-Spigot-3c1fc60-e167f28] at org.bukkit.craftbukkit.v1_17_R1.CraftServer.loadPlugins(CraftServer.java:400) ~[spigot.jar:3231-Spigot-3c1fc60-e167f28] at net.minecraft.server.dedicated.DedicatedServer.init(DedicatedServer.java:233) ~[spigot.jar:3231-Spigot-3c1fc60-e167f28] at net.minecraft.server.MinecraftServer.x(MinecraftServer.java:1010) ~[spigot.jar:3231-Spigot-3c1fc60-e167f28] at net.minecraft.server.MinecraftServer.lambda$0(MinecraftServer.java:305) ~[spigot.jar:3231-Spigot-3c1fc60-e167f28] at java.lang.Thread.run(Thread.java:831) [?:?] Caused by: java.lang.ClassNotFoundException: com.CJendantix.plugin.Plugin at org.bukkit.plugin.java.PluginClassLoader.loadClass0(PluginClassLoader.java:142) ~[spigot.jar:3231-Spigot-3c1fc60-e167f28] at org.bukkit.plugin.java.PluginClassLoader.loadClass(PluginClassLoader.java:99) ~[spigot.jar:3231-Spigot-3c1fc60-e167f28] at java.lang.ClassLoader.loadClass(ClassLoader.java:519) ~[?:?] at java.lang.Class.forName0(Native Method) ~[?:?] at java.lang.Class.forName(Class.java:466) ~[?:?] at org.bukkit.plugin.java.PluginClassLoader.<init>(PluginClassLoader.java:67) ~[spigot.jar:3231-Spigot-3c1fc60-e167f28] Again just ask for any extra details
Always look at the last cause and at the next line:
Caused by: java.lang.ClassNotFoundException: com.CJendantix.plugin.Plugin
at org.bukkit.plugin.java.PluginClassLoader.loadClass0(PluginClassLoader.java:142) ~[spigot.jar:3231-Spigot-3c1fc60-e167f28]
what does that mean, like I just started making plugins, my only experience is making mods
some time the next line does not give so much information (if it is in org.bukkit or org.spigot packages)
in your case the only thing to read is that the class "com.CJendantix.plugin.Plugin" could not be found at runtime.
Btw when I read "com.CJendantix.plugin.Plugin" I see some bad practices:
- Please avoid using caps in your packages names. only lowercase (no special chars either).
- Please don't call you main class Plugin. Prefer <MyPluginName>Plugin. For example: LeaverBanPlugin.
(I don't suggest you to ban each player who leaves your server xD)
this is just a learning experience so I'm just adding everything I learn into it and tweaking it. its meant to be general.
The fact a class is not found at runtime can come from many reasons:
- A library that is not fully included (shadowed) in your final jar for example (check your dependencies scope in maven/gradle).
- An issue that randomly happened during compilation (just build your project again).
And this list is obviously not exhaustive ^^
the dependencies are fine I think, how do I check
I remember adding them but it was tedious so I don't remember how
build.gradle file (if using gradle)
pom.xml (if using maven)
I'm not using either
ok so it's directly in eclipse/intellij/... project configuration.
but first, is the missing class (the one in the error) in your project or is it comming from a dependency ?
project
So it's unrelated to dependencies
What did you put in your plugin.yml as your main?
but its not
So it's probably about project structure.
plugin.yml issue indeed
else package with caps
else project sources folder in project config
else build again.
?
else project sources folder in project config
im asking to ask
what dat
im trying to think of my question actually sorry
its... File#mkdirs(); to create a FOLDER, yes??
https://dontasktoask.com sorry I have to
yes
??????
ok let me
give me just 2 seconds
im just confused
why is it a File if im .mkdir()ing it
File is just a pointer to a location. it can be nothign, a directory or a file
Does this work for broken blocks? I need it to work so when I break a tracked block, I get 1 of that block but with any other block I get 2 of the block
First, as ElgarL said, check that in plugin.yml specifies a main
example:
main: my.package.MyMainPluginClassThatExtendsJavaPlugin
More infos here: https://www.spigotmc.org/wiki/plugin-yml/
Then to answer you about source folder:
When creating a java project you can define what folder will contain what.
A folder can contain sources (a source file is a file endings with .java and that will be compiled)
A folder can contain resources (a resource file can be modified automatically (=filtered) but usually it's simply a file that should be copied as it is in the final generated jar file. Example: plugin.yml)
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
should i do something else then?
because i cant
calling mkdir() creates teh directory tree if it doesn;t exist
Help
it doesn;t create files
I have a major problem with my flight controls code
idk how to create directories then i guess
neither of those are the problem
How do I drop an image
i've tried .mkdirs()
same thing
and, just to confirm, you have no capital letters in your packages name anymore ?
?paste your plugin.yml
is there like something im missing
You call mkdir() on yoru file object to ensure all directories exist, then you create teh file you want
if(File#mkdir()) ?
yeah i have that
File logFile = File(getDataFolder(), "logs"); would work better
how are you creating your actual file?
π
not the File pointer. How are you creating the actual file
uhhhhh
this is the opposite of what you said By convention, Java type names usually start with an uppercase letter
Types = Class.
Package != Class
ik
package = lowercase
class = CamelCase
Is it possible for me to use steam to connect my flight controls to minecraft?
Need to do it for a sick video
gtg
I can't use the PlayerBlockTracker api in that event java final Block brokenBlock = event.getBlock(); if (PlayerBlockTracker.isTracked(brokenBlock)) { event.setCancelled(true); simply won't work
its the advertising for me
I used the example
how do I get a broken block in BlockDropItemEvent
What is e.getBlock in a BlockDropItemEvent?
Is there a write up on the new ChunkGenerator information? Just swapped from 1.17 to 1.17.1 and half the methods I was using are depreciated.
Oh Nevermind, found it.
can anyone send me an appropriate sql url example that works in their plugin? i'm using JDBC to connect to my localhost database
jdbc:mysql://localhost:3306/somesampledb
but it depends from your database management system address/port/database name
I see. And no, it's well separated ^^
Auth in a URL is probably a bad idea anyways lol
best ways to provide auth to database?
hey, how might one go about creating a void world?
So I was looking for a way to generate void worlds in version 1.13 and above, I found some threads about the subject but they were mostly unclear,...
π½
but BiomeGrid is deprecated
cant you just create a chunk generator then do nothing
ya i did that lmao
it works)
How can I save all players' data that are cached in a hashmap database every 10 minutes?
mysql
After the player enters I store his data in hashmap
just make a manager class that saves each variable to the db on a scheduler
yeah you could do that
a lot of serializers use reflection to get every field then auto save it
holy shit you're gonna have a memory leak
This is just a function to pull the information.
I'm using asynchronous when pulling the function.
You're still gonna have a memory leak
And I'm storing it in a hashmap to be cached
Still gonna leak
Alright, basically how this works is
On java, you can allocate objects to memory
When an object has no references, it gets garbage-collected (removed from memory)
What about keeping multiple connections active?
But when an object has no references, yet can't be garbage collected for some reason
You have a memory leak
Guess what variables always stay loaded in RAM?
static variables
You also have to close statements and things like that
As they also stay open
Pretty sure you can close PreparedStatement, ResultSet and things like that
I'm using hikariCP
Ehh
I'd probably just load all the player data onJoin and save it onQuit
With a timer every ~30 seconds or so
I really really recommend you learn how memory and the JVM works before diving into databases and such
ScheduleSyncDelayedTask is still sync
also ew Β§ color codes
There are many code quality issues you should look into fixing honestly
I know databases might seem exciting but I don't want you to grow into bad practice
Not just
?
There's a use for static
Static is made for variables that should be always loaded in memory
And effectively final
The JVM won't really try to actively garbage collect most static objects
But looking at your code it's cluttered and messy
You don't follow naming conventions, keep all your variables public, instead of having getters
Can't tell the difference between sync and async
Also you can just hover over runnable and it will turn it into a lambda for you
BukkitRunnable cannot be as lambda
I think
Their code is literally suggesting it π€¦π»
They are also using a runnable and not a bukkit runnable
Most likely copy and pasted code
Also @quaint mantle Isnβt the account manager creating a new account going to be running a Db query meaning that needs to be async
You can also just put the code where it adds the stats in the create and get account as it will save you having to schedule another task
when is PrepareItemCraftEvent called? i looked in java docs am I just blind
Whilst it still works its basically a delegate of
BukkitScheduler::runTaskLater::getTaskId or smtng iirc
1.7 isn't supported anymore
Wdym normal cow
NMS cow is the same as normal cow
It does
How else would it move
Cows do move in 1.15
Why would it move
That's a packet entity
It doesn't exist on the server
So ofc it doesn't move
Don't call a packet cow nms cow
NMS cow moves and exists on server
You will need to make your own system
You need to pathfind send packets etc
Or you know NOT spawn it with packets
Then use packets to remove it from others
Also no need for NMS cow here
use the destroy entity packet
I have a fun issue today
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.
dude says he's using a datapack item
it's slipping through my checks and through the checks of seemingly several other plugins
it errors on the return line
the last line?
yeah
impossible
that's what I said
line 28
yeah no doubt
it's some cursed shit, at least illegalstack is doing the exact same error
if it were null the earlier test would haev caught it
and yet here we are?
I mean is it at all possible datapacks have invented an innovative and fun way for inventories to cause errors
because we did not have enough of those
maybe we're checking for air and null but we should also be checking for Null, the new class by mojang
The only thing I see thats odd is using .equals to check for AIR
I've been doing that for so long it's in my dna now
have you tried a sysout on getCurrentItem() ?
?stash
Something about that item is returning a null nbttagcompound1
or they are using AIR as a custom item, somehow. I don;t even know if thats possible in datapacks
soirry had to go run an errand, they say they're using this data packhttps://www.planetminecraft.com/data-pack/minifurnaces-2-0/
so they probably don't know if it's using air
?paste
I've never used datapacks, but shoudl that second line not start minecraft:air not just air? https://paste.md-5.net/
paste's dead
its in two places in teh datapack
in file data\minifurnace\functions\furnace.mcfunction
dude having the issue says he'll edit it, I'll let you know if that fixed it when I hear back from him later
I still can't work with attributes, I want something like this:
- An entity gets some base values like speed, damage, etc
- I also want to upgrade it every kill with 5%
- I want to get the values
I can't make the last two
if you are spawnign with packets they don;t really exist on the server
so your limit is client side or bandwidth
Hello, can I register commands like this?
getCommand("clw get").setExecutor(...);
If yes, will "get" be in args as args[0] or not at all? Thanks for help
No spaces allowed
thanks
You register teh root command only
you want to register as clw, and get is automatically args[0] if provided
And how do you write description of other than root commands? You just list them in plugin.yml?
Yes
But I still recommend just the root command as description, and create a help menu for sub commands
sub commands don't go in the plugin.yml
Thank you for help
How can I despawn a Wolf temporary? I tried with .setInvisible and .setAI but that is not enough
then setCollidable too
false
Ok thx and invulnerable also false?
true
Ok thanks, I will test it
Is there a way to make a explosion created by createExplosion shieldable?
(When a creeper explodes, I can use my shield to block damage, doesnt work with that method)
Is there a way to just spawn an entityexplosion?
And also how do you make permissions for subcommands?
if(sender.hasPermission
Again no need to list them in plugin.yml?
What is plugin.yml file used for? I would like to have deeper understanding
Its mainly for just registering the commands and telling the server that it is a plugin by giving him the plugin name & instructions on how to run it (main class)
wolf.setAI(false);
wolf.setInvisible(true);
wolf.setSilent(true);
wolf.setAngry(false);
wolf.setInvulnerable(true);
wolf.setCollidable(false);
then teleport it way up in the air
Won't it fall?
with no AI it will not be subject to gravity
Ok, then something like y=300 and then teleport it back if they want it visible again
Because it must not be reachable by build limit
Location location = wolf.getLocation(); location.setY(location.getWorld().getMaxHeight() + 20);
wolf.teleport(location);
do you want to lag a player or what? π€£
If i try to kick players from the server in onDisable it does not work if the server is reloading, they will get kicked later, or not and I even do not see my custom message
there is an event called before reloading
or PlayerCommandPreprocessEvent and listen for /reload
Ok good idea, thanks
Which one?
that event is for console commands
Yes then I need to listen for both
.
That doesnt count as an entityexplosion
I want the explosion to be blockable with a shield
can anyone help me with debugging? i am bad at it :p
what event do I listen to if I want to check if an arrow is still in the air
ProjectileLaunch Event?
<T extends CustomFile>
Why does T.class.equals(getClass()) NOT work?
debugging is easy?
what are u struggling with?
System.out.println
breakpoints save you much more time and sysouts
can someone help me, i need a tutorial of the pluigin geiserbungecoord please
you dont have to recompile everytime for a sysout statement
please
Google your question before asking it:
https://www.google.com/
im trying to debug code that is difficult for me
your going to have to be more specific
google does not help, and seen several tutorials and not one says how to configure it
im not psychic
Wym not work
Oh
Thatβs because of type erasure
When running T will just be CustomFile
Well pass a parameter of Class<T> cls then use cls == getClass()
I am create a method with will automatically return the class without casting, but I need to know if T is a YamlConfigFile.class (extends CustomFile) or just a raw one
I'm making it so that a cobble gen generates random ores, and i am trying to debug why it does not work
private static final Material[] MATERIALS = new Material[]{
Material.COBBLESTONE,
Material.STONE,
Material.COAL_ORE
};
public Material getRandomMaterial() {
final ThreadLocalRandom random = ThreadLocalRandom.current();
return MATERIALS[random.nextInt(MATERIALS.length)];
}
@EventHandler
public void onCobbleGen(BlockFormEvent event) {
if (event.getBlock().getType() == Material.COBBLESTONE) {
event.getBlock().setType(Material.AIR);
event.getBlock().setType(getRandomMaterial());
}
}
I need the custom geyser-bungeecord plugin
I will try it without, because I already have the class
:c
But I just can't return getClass
Elaborate
?
Anyways you need to pass a type aware argument if you want type aware returns
using this and replacing in my desired database just results in this error: ```Establishing SSL connection without server's identity verification is not recommended. According to MySQL 5.5.45+, 5.6.26+ and 5.7.6+ requirements SSL connection must be established by default if explicit option isn't set. For compliance with existing applications not using SSL the verifyServerCertificate property is set to 'false'. You need either to explicitly disable SSL by setting useSSL=false, or set useSSL=true and provide truststore for server certificate verification.
Ok thanks
So just put System.out.print() so on getRandomMaterial, you might want to know is it pasing it back correctly? so try to print the material its passing back in System.out.print()
Basically at every if statement you need to add a System.out.print() then use those to see whats happening
so here
if (event.getBlock().getType() == Material.COBBLESTONE) {
put a System.out.print before that that outputs what the blocktype is, if its not cobblestone you know your issue is there
just the base sout method?
I mean you can use whatever
just anything that outputs it
sout Loggers, Bukkit.broadcastMessage
you can also just exit the system everytime it works
So for example?
public Method() {
System.out.println();
}
Just like that? I have never done debugging in my life :p
seems like you have never done java in your life
ok, harsh, but is it right?
you probably want to give yourself some informations with it
help me π¦
Γ‘ printing something (a l(i)n(e))
@ivory sleet I found this on StackOverFlow
T data = new Gson().fromJson("{}", new TypeToken<T>(){}.getType());
if(!data.getClass().equals(getClass())
....
yes but what?
simple example:
public void debuggingMyCoolStuff() {
System.out.println("cool stuff works");
}
and if you want to debug everything
It's easier to do if you don't put it in a method also
Just put the sout where you would call the method
it would probably look like this:
public void debuggingMyCoolStuff() {
if(broken) {
System.out.println("broken");
return;
}
if(true) {
System.out.println("true");
} else {
System.out.println("false");
}
System.out.println("done");
}
a very useful if statement
if it prints false you should uninstall your computer
Yep 
Yeah but that's not 100% to give you a type token which is valid
because T might get erased
Ok still thanks
Usually something like
TypeToken<List<Map<String,Reference<Player>>>> token = new TypeToken<List<Map<String,Reference<Player>>>>(){};
would work because it's effectively the same as
class SomeToken extends TypeToken<List<Map<String,Reference<Player>>>> {
}
TypeToken<List<Map<String,Reference<Player>>> token = new SomeToken();
and in SomeToken the type List<Map<String,Reference<Player>>> cannot be erased since it has to be there at runtime due to explicit derivation (idr the actual term for it but yeah).
asdf
anyone know the gradle dependency statements for hikariCP
the same as maven but gradle
https://mvnrepository.com/artifact/com.zaxxer/HikariCP/5.0.0
i copied the gradle repo tag from here and tried using an import statement but it doesn't work
make sure you have mavenCentral() in your repositories
i do... is this line supposed to go in repositories or dependencies?
central in repositories, hikari in dependencies
ope don't need that, i got it to compile
What event should I listen to for creating an explosion on an arrow while it's alive
Like when it's in the air or when it hits something
when it's in the air
ProjectileLaunchEvent will give you the arrow. You'll just have to figure out when to create the explosion so it's not exploding in their face
?paste
where is the db.properties file for my locally hosted sql server?
I have this piece of code and I don't see why it's not working https://paste.md-5.net/veyulepowa.cs
Change other settings in your driver connection configuration like, in your case, SSL.
The explosion happens in a runnable
What do you mean "not working". What does it do?
It will not create an explosion, I did register events in my main class
Well for one you should be using runTaskTimer() instead of scheduleSyncRepeatingTask.
Add some souts, my guess is that shot is not being set to true.
Why is it not getting set to true?
I assume bow() returns an ItemStack?
yes
Do p.getInventory().getItemInMainHand().isSimilar(bow())
You should add a log line in that if statement too so you know it's being set.
nothing is returning
Then they aren't holding whatever bow() is returning.
when the durability goes down, it doesn't work
I am just going to get the item name
still doesn't create explosion though
I got it to work with the display name but the runnables are not working
I get a true message
ah so what method is triggered for every time the logger prints something to the console??
Spigot uses a log4j root logger
cool. i will check into this thread. i don't want to mute but obtain and push into a database
Add more print statements then
https://logging.apache.org/log4j/2.x/log4j-api/apidocs/index.html does that seem about right
oh gosh. each message has its own type possibly π¬
should I use while (arrow.isValid()) ?
Sure
even with this piece of code, it doesn't explode ```java
if (p.getInventory().getItemInMainHand().getItemMeta().getDisplayName().equalsIgnoreCase(name)) {
shot = true;
p.sendMessage("" + shot);
while (arrow.isValid()) {
arrow.getWorld().createExplosion(arrowLoc, 1);
}
}```
?
Well if the arrow is valid you just stuck it in an infinite loop
I know
There is nothing stopping the explosion yet there is no explosion?
Remove the arrow.isValid() check and print arrowLoc.
ok
It does return the location
Send your code again
Arrow arrow = (Arrow) e.getEntity();
Location arrowLoc = arrow.getLocation();
Player p = (Player) e.getEntity().getShooter();
String name = bow().getItemMeta().getDisplayName();
if (bow() != null) {
if (p.getInventory().getItemInMainHand().getItemMeta().getDisplayName().equalsIgnoreCase(name)) {
shot = true;
p.sendMessage("" + shot);
p.sendMessage(arrowLoc + "");
}
Smp.instance.getServer().getScheduler().runTaskTimer(Smp.instance, () -> {
arrow.remove();
shot = false;
}, 0, 100);
}```
You're not creating an explosion anywhere in there 
Put it back, just not in the while
ok
Works
1 explosion happens
just need to to go on while the entity is alive
That's what the Timer is for
Changed up my code ```java
@EventHandler
public void bowShoot(ProjectileLaunchEvent e) {
Arrow arrow = (Arrow) e.getEntity();
Location arrowLoc = arrow.getLocation();
Player p = (Player) e.getEntity().getShooter();
String name = bow().getItemMeta().getDisplayName();
World world = p.getWorld();
if (bow() != null) {
if (p.getInventory().getItemInMainHand().getItemMeta().getDisplayName().equalsIgnoreCase(name)) {
shot = true;
p.sendMessage("" + shot);
Smp.instance.getServer().getScheduler().runTaskTimer(Smp.instance, () -> {
p.sendMessage(arrowLoc + "");
world.createExplosion(arrowLoc, 1);
}, 0, 5);
}
Smp.instance.getServer().getScheduler().runTaskLater(Smp.instance, () -> {
arrow.remove();
shot = false;
}, 100);
}
}``` i'm getting the world from the player and running the arrow.remove task later
still doesn't work
How many explosions does it make? One in the same spot over and over?
none
Does it print the location
no
Does it print anything...?
Then the if statement is failing again. Make sure you're holding the bow with the right name, and that the bow actually has a name.
Can you make custom items using resource packs, without using durability items like hoes, swords, pickaxes, axes and shovels in 1.17? Whilst still preserving the original items. Like if I would add a new texture for the cyan_dye to simulate another item. Etc.
it prints true though
that happens after the if
You can use custom model data.
You set it on the item and in the resource pack
the runnables aren't working... why?
its completely scuffed
i mean you are using the result of bow() and checking AFTERWARDS if its null
the shooter is not always a player
I removed null
make sure the name of the item is exactly your name string
ItemStack#isSimilar would make more sense here
cant really see what you did down there since its aids to look at it at the phone
but what is not working @vast sapphire
is there a performance difference between using a single (for example) EntitySpawnEvent for many things and using many of these for each a single thing?
it won't create an explosion at arrowLoc in the runnable
arrowLoc probably null
you are using it outside the eventhandler
and its a local variable
inside the eventhandler
Nothing is being printed now and the variables are still in the eventhandler along with the runnables ```java
@EventHandler
public void bowShoot(ProjectileLaunchEvent e) {
Arrow arrow = (Arrow) e.getEntity();
Player p = (Player) e.getEntity().getShooter();
Location arrowLoc = arrow.getLocation();
World world = p.getWorld();
if (e.getEntity().equals(p)) {
if (p.getInventory().getItemInMainHand().isSimilar(bow())) {
shot = true;
p.sendMessage("Shot true line");
Smp.instance.getServer().getScheduler().runTaskTimer(Smp.instance, () -> {
p.sendMessage(arrowLoc + "");
if (arrowLoc != null)
world.createExplosion(arrowLoc, 1);
}, 0, 5);
Smp.instance.getServer().getScheduler().runTaskLater(Smp.instance, () -> {
arrow.remove();
shot = false;
}, 100);
}
}
}```
isSimilar probably breaks since the durability is prob. not the same.
anyways, it still wont work. you are sending your runnable out of the eventhandler scope. the local variables "world", "arrowLoc", "p" will just exist in the eventhandler scope iirc
it's unbreakable and it's still not working
so I should define the vars inside the runnable
Will this not cause errors as youβre casting the entity to an Arrow however what happened when a snow ball gets launched?
That would throw an error
the entity is the error
a skeleton will make problems
oh and snowballs too, yeah
Do a check if βevent.getEntity instance of Arrowβ or something
same with shooter for Player
Yup
if the permission string in the plugin.yml in not filled in, is the value null or just empty string?
Or just donβt add it
here is my code now: ```java
@EventHandler
public void bowShoot(ProjectileLaunchEvent e) {
Player player = (Player) e.getEntity().getShooter(); //Variables are now locally defined in runnables
Arrow projectile = (Arrow) e.getEntity();
if (e.getEntity().getShooter() != null && e.getEntity() == projectile) {
if (player.getInventory().getItemInMainHand().isSimilar(bow())) {
shot = true;
player.sendMessage("Shot true line");
Smp.instance.getServer().getScheduler().runTaskTimer(Smp.instance, () -> {
Arrow arrow = (Arrow) e.getEntity();
Player p = (Player) e.getEntity().getShooter();
Location arrowLoc = arrow.getLocation();
World world = p.getWorld();
p.sendMessage(arrowLoc + "");
if (arrowLoc != null)
world.createExplosion(arrowLoc, 1);
}, 0, 5);
Smp.instance.getServer().getScheduler().runTaskLater(Smp.instance, () -> {
Arrow arrow = (Arrow) e.getEntity();
arrow.remove();
shot = false;
}, 100);
}
}
}```
You're still going to have casting issues, and really the only thing that needs to be defined in the Runnable is the Projectile location.
On top of your βArrow projectile = (Arrow) event.getEntityβ
Add this line
βIf event.getEntity instanceof Arrowβ
Also why have you got like 3 runnable?
Well tasks
There's nothing wrong with the Runnables themselves
I know but itβs a bit aids π
Make explosion at the arrow every 5 ticks, stop doing that after 100 ticks
How would you do it? You could make 2 static Runnables in theory but that would involve storing the Projectiles in a list
Which is just a pain 
Create explosions on flying arrows.
Well Iβd have one runnable
That starts when he shoots
And creates the effect whilst itβs moving
that's why I have this e.getEntity().getShooter() instanceof Player
Okay well do that for Arrow too
i did
Good
still doesn't work
yes or I wouldn't get the shot line message
Okay just some people donβt lmfaoo
Yeah, but that still involves creating a Runnable for each Projectile. There's definitely no need for 2 Runnables here but considering the other issues that's a low priority problem 
what's a better way of removing the arrow?
Ofc
You can just check if the arrow is on the ground or if it's dead and then stop.
No need for the 100 tick removal thing
will it never touch the ground if there are explosions?
I am trying to make it so it destroys blocks for 100 ticks, if it hits the ground it won't destroy those blocks
why is it not creating an explosion then? ```java
@EventHandler
public void bowShoot(ProjectileLaunchEvent e) {
Player player = (Player) e.getEntity().getShooter(); //Variables are now locally defined in runnables
if (e.getEntity() instanceof Arrow) {
Arrow arrow = (Arrow) e.getEntity();
if (e.getEntity().getShooter() instanceof Player && e.getEntity() == arrow) {
if (player.getInventory().getItemInMainHand().isSimilar(bow())) {
shot = true;
player.sendMessage("Shot true line");
Smp.instance.getServer().getScheduler().runTaskTimer(Smp.instance, () -> {
Location arrowLoc = arrow.getLocation();
World world = player.getWorld();
player.sendMessage(arrowLoc + "");
if (arrowLoc != null)
world.createExplosion(arrowLoc, 1);
}, 0, 5);
Smp.instance.getServer().getScheduler().runTaskLater(Smp.instance, () -> {
arrow.remove();
shot = false;
}, 100);
}
}
}
}```
send arrowloc
in system.out
or chat
to see what it retuns
basically, do debugging
after every if send something to console or chat
not getting any message from the runnables
the if statements work
Im trying to make my plugins performance better and I have a few questions for someone who knows stuff about it.
- should I make variables instead of calling config.get whenever I need it?
- is there a difference in performance between using multiple events that could be made into one or not?
- any other way of improving performance?
Im not really having problems with performance but its always nice to save those nanoseconds π
(posted into help server by accident, lol, deleted it there now)
- depends
- depends
- probably
Config is one big hash map
if you use config.get() with the same argument give it a variable
for example when a blaze shoots a fireball I was accessing config 3 times per projectile
For events, having multiple listeners isn't a big deal but try to avoid registering one per something
For example if 10 players have protected areas don't have 10 listeners for the events to protect those areas
Not a big deal but might be worth using variables
Or a config framework
I have one you could use which loads all the data from config into variables automatically
?paste
currently im planning on using this https://paste.md-5.net/cocidozome.cpp instead of accessing those 3 each time a blaze shoots
Doesn't seem very OOP but I guess it works
im kinda new to Java so if you know a better way I would love to know that. π
It'd be overkill for something like this
But I would probably make an enum for the different types
Map them to weights
And load them into a weighted random from config
Then when a fireball is launched, roll the weighted random to see what outcome to apply
currently I have a setup like that, hold on.
Ideally each enum would contain a lambda which could handle it so you wouldn't have repetitive code
my own version tho XD
and not as sophisticated
I roll a random number and see which one it applies to
That's really not at all what I described and is also a bastardization of probability
It won't work if the numbers don't add up to 100
for a weighted system instead of % i could just set rn to Methods.randomNumber(0, (sum of all chances))
if the numbers are under 100% it just means that the blaze will shoot a normal fireball as it is supposed to. if its over the chances wont work properly tho.
That's why you add a fourth option for a normal fireball
I have a weighted random utility class you can steal if you want
I would love to steal that!
ive never understood the T people put in their class<>
might learn that next semester then... XD
I'm sure you have seen that before right?
It's not hard
<T> just means the type is generic
List<T> means you tell it what <T> is when you make it
oh that makes sense
So, List<Integer> list = new ArrayList<>();
This is saying "this is a list of integers"
Java is statically and strongly typed
If it didn't have generics, you'd just have to have List return Objects
And cast
That's what we actually had to do in the first version of java
But generics are a way of saying that a type exists in relation to another type
oh i get it. thats why you have a map with <T, Double>. so you can tell it what type the name or whatever is when you get to it
You never have just a List, it's always a list of something
You can tell it what type it is rolling
That map maps the type it rolls for to their weights
ye
So you can have it roll and return whatever
My library also has a config manager you could use for loading data from config easily but that might be a bit advanced if you're new to java
sounds too complicated. I might just have to keep coding until my profs get to the generics. thank you so much for explaining it tho π I understood a good amount more from that π
Is there any way to summon a player lit tnt?
Hello, My friend gets ping bot attacks to his server. The ip-addresses are always different and they ping the server millions a second. The problem is on a Bungee proxy
Can I write a plugin to protect him?
How would I do that in code?
Ok thanks for the idea
Why is teh proxied server ip exposed?
or aer they attacking bungee?
Oh I said it wrong, his Spigot servers UNDER Bungee are getting attacked
Yes, why are his servers IP's exposed?
I don't know that
sr.getScaledWidth() - (width / 2) should get me the center correct?
he needs to read teh section on securing his network on the installing bungee wiki
What is the beat way to create hologram text displays?
Ok thanks
no, width is teh object
so you need (windowWidth / 2) - (width / 2)
oh ya
you need the MC window width, not sure what sr is
it's the window width
I'd doubt that. It has a reference to scaled so I'd guess thats somethign to do with UI
ui screen?
probably
wouldn't I want to use that anyways
if you are going to scale everything depending on teh UI scale setting
you can always sysout and see what its value is
I remember you found an mc.width or something
if its half then you don;t need to divide the first by 2
so this is actually correct what Isaid then
but doesn't center it
then you are adding somethign and moving it right, or those values are not correct
I thought width was the width of what you are drawing
I'm trying to put a image at the top center
but I already got it to the top I just need to center it
use teh width of whatever you are drawing
i am
Yes, IF width is teh width of the thing you are drawing
it is
Hi, i need to send a particle packet to a player using protocollib. I have written this, but it kicks the player saying: io.netty.handler.codec.EncoderException: java.lang.NullPointerException: Cannot invoke "net.minecraft.core.particles.ParticleParam.getParticle()" because "this.j" is null.
Why?
https://pastebin.com/uWR40sUY
This is the page that i'm using: https://wiki.vg/Protocol#Particle
No values inside of it
paste teh full error
I don't even see this.j in your code
he's reading an nms line from the error stack
In fact i'm not using a J variable
elgar this is what im doing drawModalRectWithCustomSizedTexture(sr.getScaledWidth() - (width / 2), 0, 0.0F, 0.0F, 120, 100 ,120, 100);
yea
can you not get those values instead of hard coding?
it also says: https://pastebin.com/NVdNiB1P
show full errors or its unlikely anyone can help
is your protocol lib full yup to date?
The version of the official spigot page
your error seems to indicate you are only getting a single Integer, so you can't write 1,100
The problem is that from the packet page i can set 2 integer value (0 and 1)
https://wiki.vg/Protocol#Particle
why is there no explosion at arrowLoc? ```java
@EventHandler
public void bowShoot(ProjectileLaunchEvent e) {
Player player = (Player) e.getEntity().getShooter();
if (e.getEntity() instanceof Arrow) {
Arrow arrow = (Arrow) e.getEntity();
if (e.getEntity().getShooter() instanceof Player && e.getEntity() == arrow) {
player.sendMessage("shooter");
if (player.getInventory().getItemInMainHand().isSimilar(bow())) {
shot = true;
player.sendMessage("Shot true line");
final int[] count = {0};
Bukkit.getScheduler().scheduleSyncRepeatingTask(instance, new Runnable() {
@Override
public void run() {
player.sendMessage("runnable on "+ count[0]++);
Location arrowLoc = arrow.getLocation();
World world = arrowLoc.getWorld();
world.createExplosion(arrowLoc, 1);
}
}, 0, 20);
}
}
}
}``` I implemented the run method this time and still nothing.
This is the full error: https://pastebin.com/7PFUYqK1
Definitely says you only have 1 to play with Field index out of bounds. (Index: 1, Size: 1)
sysout packet.getIntegers().size()
Should I try this?
nah don;t bother
I'd take a look at this: https://github.com/dmulloy2/PacketWrapper/blob/master/PacketWrapper/src/main/java/com/comphenix/packetwrapper/WrapperPlayServerWorldParticles.java
i put the runnable in my main class and it works
it says '1'
If it says 1 then the packet you are building seems to only support 1
packet.getIntegers().write(0, WrappedParticle.create(Particle.DRIP_LAVA, ?));
?
Should I copy it in my project and create the packet?
If you want
I donβt think so anyways
When i publish a plugin, can i post a donate link on the site?
It always depends, but usually yes
Ok and can i ling my git-hub? Because you need a second program for my plugin.
*link
I think so? Just note that it should be able to run on spigot, so if that other program is a spigot fork then that wont work
It is a normal jar program
How can i stop custom mobs being afraid from the sun?
Fuck with their NMS
Give them a helmet
hii
my intellij is having problems
can someone compile a plugin for me?
(sadly no maven or gradle project)
Any way i could make the helmet invisible
Resource packs
Or fire resistance
I think you can also put any item on their head, including something like a button which would be covered by the head model
Hey so uhh, Ive been trying for a long time and I cant find out how to change the project java version.
I don't know how to do it in eclipse
Maybe right click on the system library and there will be an option there
I don't know
When I do right click on my plugin folder thing something called proberties is there
It might be in there
Theres all this stuff there:
Think It would be in any of those?
Project menu -> properties -> Java Build Path -> select Libraries tab. Java system library and click edit
Thanks :D
Hi im back and I would like to know what is wrong with my plugin.yml Invalid plugin.yml
version: 1.0
author: CJendantix
main: com.CJendantix.plugin.Plugin
api-version: 1.17
commands:
heal:
description: Heals and Feeds player to max.
usage: /<command>
aliases: feed```
Full stack trace pls
wdym
Your 'error' message
Could not load 'plugins\plugin.jar' in folder 'plugins'
org.bukkit.plugin.InvalidDescriptionException: Invalid plugin.yml
at org.bukkit.plugin.java.JavaPluginLoader.getPluginDescription(JavaPluginLoader.java:170) ~[spigot.jar:3231-Spigot-3c1fc60-e167f28]
at org.bukkit.plugin.SimplePluginManager.loadPlugins(SimplePluginManager.java:144) ~[spigot.jar:3231-Spigot-3c1fc60-e167f28]
at org.bukkit.craftbukkit.v1_17_R1.CraftServer.loadPlugins(CraftServer.java:400) ~[spigot.jar:3231-Spigot-3c1fc60-e167f28]
at net.minecraft.server.dedicated.DedicatedServer.init(DedicatedServer.java:233) ~[spigot.jar:3231-Spigot-3c1fc60-e167f28]
at net.minecraft.server.MinecraftServer.x(MinecraftServer.java:1010) ~[spigot.jar:3231-Spigot-3c1fc60-e167f28]
at net.minecraft.server.MinecraftServer.lambda$0(MinecraftServer.java:305) ~[spigot.jar:3231-Spigot-3c1fc60-e167f28]
at java.lang.Thread.run(Thread.java:831) [?:?]
Caused by: java.io.FileNotFoundException: Jar does not contain plugin.yml
Caused by: java.io.FileNotFoundException: Jar does not contain plugin.yml
What is your build tool and what folder is plugin.yml in
I'm not using gradle or maven so my build tool is eclipse and my plugin.yml is in src
Should be in the root folder
ahh
thanks
now this [15:47:02] [Server thread/ERROR]: Could not load 'plugins\plugin.jar' in folder 'plugins' org.bukkit.plugin.InvalidPluginException: Cannot find main class `com.CJendantix.plugin.Plugin' at org.bukkit.plugin.java.PluginClassLoader.<init>(PluginClassLoader.java:69) ~[spigot.jar:3231-Spigot-3c1fc60-e167f28] at org.bukkit.plugin.java.JavaPluginLoader.loadPlugin(JavaPluginLoader.java:145) ~[spigot.jar:3231-Spigot-3c1fc60-e167f28] at org.bukkit.plugin.SimplePluginManager.loadPlugin(SimplePluginManager.java:394) ~[spigot.jar:3231-Spigot-3c1fc60-e167f28] at org.bukkit.plugin.SimplePluginManager.loadPlugins(SimplePluginManager.java:301) ~[spigot.jar:3231-Spigot-3c1fc60-e167f28] at org.bukkit.craftbukkit.v1_17_R1.CraftServer.loadPlugins(CraftServer.java:400) ~[spigot.jar:3231-Spigot-3c1fc60-e167f28] at net.minecraft.server.dedicated.DedicatedServer.init(DedicatedServer.java:233) ~[spigot.jar:3231-Spigot-3c1fc60-e167f28] at net.minecraft.server.MinecraftServer.x(MinecraftServer.java:1010) ~[spigot.jar:3231-Spigot-3c1fc60-e167f28] at net.minecraft.server.MinecraftServer.lambda$0(MinecraftServer.java:305) ~[spigot.jar:3231-Spigot-3c1fc60-e167f28] at java.lang.Thread.run(Thread.java:831) [?:?] Caused by: java.lang.ClassNotFoundException: com.CJendantix.plugin.Plugin at org.bukkit.plugin.java.PluginClassLoader.loadClass0(PluginClassLoader.java:142) ~[spigot.jar:3231-Spigot-3c1fc60-e167f28] at org.bukkit.plugin.java.PluginClassLoader.loadClass(PluginClassLoader.java:99) ~[spigot.jar:3231-Spigot-3c1fc60-e167f28] at java.lang.ClassLoader.loadClass(ClassLoader.java:519) ~[?:?] at java.lang.Class.forName0(Native Method) ~[?:?] at java.lang.Class.forName(Class.java:466) ~[?:?] at org.bukkit.plugin.java.PluginClassLoader.<init>(PluginClassLoader.java:67) ~[spigot.jar:3231-Spigot-3c1fc60-e167f28]
@young knoll
Cannot find main class `com.CJendantix.plugin.Plugin'
The path to your JavaPlugin class is faulty
soo
Correct the path in your plugin.yml
wait I fix
first how does this tie into spigot
friends list thingy
Comparator
sorting by if they are online
k
Lists.sort() with a Comparator<T> provided
hey! i'm here to ask a question, i want to take a minecraft server's seed and find the ore locations in between a 0-10000 block location, maybe save it to a txt for later use, is this possible?
but if i sorted by the boolean first and then made another comparator with the int, wouldnt that just sort it by the int instead and remove the boolean sorting
Yes. If you got the seed then you can generate the world and scan all chunks.
Sort by A, if the result is 0 sort by B, etc etc
can u please dm me a quick short explanation of the method's i could use? please! it would be really helpful
wdym
This is going to be quite a bit of work. There arent just "a few methods" you can use.
if u have any spare time, could you give me a prep talk about it?
Something like
i = sortA
if (i == 0)
i = sortB
if (i == 0)
i = sortC
return i
Im actually writing a plugin which is going to be used to analyse a ton of chunk data. With minor tweaks it can probably do what you want.
Ill take a look at it in 10min
when i say sort, i mean order by
Correct
thank you so much dude!
so if i did that, it would order an entire messed up list
to
online people above offline people
sorted by rank
and in the rank category, sorted by name
so this list
VIP JohnDoe - Offline
VIP+ IdkWhatToCallThisOne - Offline
SameGoesForThisOne - in the lobby
VIP+ Abcdefg - Offline```
would become
VIP+ Abcdefg - Offline
VIP+ IdkWhatToCallThisOne - Offline
VIP JohnDoe - Offline```
right?
sort it to that
how do i sort a list by
- Online (boolean)
- Rank Weight (int)
- Name (alphabetical)
i wanna make it so
VIP+ IdkWhatToCallThisOne - Offline
SameGoesForThisOne - in the lobby
VIP+ Abcdefg - Offline```
would become
```SameGoesForThisOne - in the lobby
VIP+ Abcdefg - Offline
VIP+ IdkWhatToCallThisOne - Offline
VIP JohnDoe - Offline```
I use spigot api 1.8.8, how can i detect the hit on an EntityArmorStand by the player
- 1.8 is old and unsupported. Update.
- EntityDamageByEntityEvent
EntityDamageByEntityEvent doesn't work
EntityArmorStand
dat sux
Client side I assume?
yes
Wait so its not a physical armorstand?
Then listen for incoming packets.
I send PacketPlayOutSpawnEntityLiving to my player but when he hits the armorstand nothing happend
listen for incoming packets
how can i do that please
ugh, NMS magic?
ProtocolLib
thx
can someone send me to the spigot documentation (if it exists)
?jd
Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.1:compile (default-compile) on project MaxicraftFriendsParties: Fatal error compiling
what lol
no other errors
just that
There should be more
well there isnt
not spigot related but i want to make all clock related data (hour, minute, second and millisecond) to be zero
how to convert "Color" to "ChatColor"
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.
the output:
as you can see, sometimes it is 12h and others is 0
how would i get a list of all the configuration section? for example i had
1: "e"
2: "e"
test2:
1: "e"
2: "e"
test3:
1: "e"
2: "e"```
how could i get test1, test2, and test3 and store them?
YamlConfiguration is a ConfigurationSection
so
config.getValues(true)
will return as map
HOUR_OF_DAY instead of HOUR
π€‘
you helped my 7 months plugin. thanks
no problem π
I donβt think there is any direct conversion, if they have the same name you can use valueOf
Otherwise you could use a switch statement
not sure about that, but i think it is used in the translateAlternateColorCodes
using getValues(false) showed up as
List:{1=MemorySection[path='1', root = 'YamlConfiguration']
mmh, are hex'es made with this?
which spigot version?
im in 1.17.1
this is exactly what i put
plugin.getConfig().getValues(false)
no they are their own sections
The hex format is &x&r&r&g&g&b&b iirc
If you are dealing with user input you may want to write some code to convert &#rrggbb instead
Does it have to be spigot to use hexes? I thought version support was enough
im talking about the chatcolor class
I don't know, it may belong to another Class, I'm just trying to learn how xd
there is no parent, my config is the example i sent
.
^
just checked, that field is from bungeecord
understood, i will search, thanks for attention <2
The bungee version is part of spigot
π€ π π
You should pretty much always use it over org.bukkit.chatcolor
at least when running buildtools
so i have 3 different sections in my config (the example i sent) and all it did was send List:{1=MemorySection[path='1', root = 'YamlConfiguration'] 3 times but for each one so instead of it being '1' it would be '2' etc
how do you get the compile method to work in a build.gradle file
check the line 70
you mean compileOnly?
?paste
then just do config.convertToMap(config)
i mean compile... all the examples for log4j libs have a compile function like in the paste above https://paste.md-5.net/aduzibepip.nginx
it worked now tysm ::))
compileOnly
i'll change it and i believe you. i jsut don't know why they do it with compile in their examples π
getValues does exist, but it returns a map of key - value
And that value may be a further configurationsection
maybe it is out of date
which with recursive methods it can be fixed
which version of log4j does spigot use?
I have a list of one hit materials and i'm trying to compare the broken block to the list and if it's equal to an object on the list then it won't create an explosion. here is my code java for (Object mat : ItemStacks.oneHItMaterials()) { if (e.getBlock() != (mat)) { p.getWorld().createExplosion(e.getBlock().getLocation(), 1); } break; }
here is my list: https://paste.md-5.net/owowosoyop.cs
my god
Uh
first this should all be handled with a config < i recommend
second, this should be handled with a set and #contains
if (materials.contains(material)) {
p.getWorld().createExplosion(block.getLocation(), 1);
}
thanks
1.17 is java 16+
ah
Can someone help me at #help-server
good an easy copy and paste into a java 16 project solved that issue
wait really
nah i'm not referring to ur issue lol
oh oops
1.17 < 8
1.17 > 16
i dont think that helped him
is there an alternative for Bukkit/Server#craftItem and Bukkit/server#getCraftingRecipe in the 1.16 api?
Hey I am wondering how to do this. Compass Tracker how do I add it into my minecraft game or world? can someone help me?
why are stone blocks not breaking but dirt is on the explosion? java if (p.getInventory().getItemInMainHand().isSimilar(ItemStacks.pickAxe())) { if (!ItemStacks.oneHitMaterials().contains(e.getBlock().getType())) { p.getWorld().createExplosion(e.getBlock().getLocation(), 1.9F, false, true); } }
Also when I mine ores, the explosion works as intended but when I break stone it's like using the pickaxe normally?
! means 'not'
The player tracker plugin. How do you add it to my world? because I never done anything with plugins before