#help-development
1 messages · Page 1681 of 1
Might just put the tab executor in the main class then I guess
its just a method name change
same args
then in yoru main register the Command Executor
Do you know what a Set is?
how do I get something akin to a hashmap that allows duplicate keys?
@lost matrix Removing craftmob from the spigot entity did not change it, neither did removing bukkit mob from the interface
no i havent learn it from course
so I need an actual list for duplicate keys?
duplicate entries
the whole point of a keySet is that a single key references one value
if you want to store multiple objects under that key you can
but you use one key
meh, might just use the Location as a key and the uuid as a value
works all the same, just cant read it as well from the file
what are you trying to do?
Im making a plugin so you can lock chests and they cant blow up. im trying to limit the amount of chests a player can lock
use Block not location for a start
fair
then store as Map<UUID, Set<Block>>
didnt think of that, thanks 😄
Try manually overriding the getPose() method. @Override
might just use a list as the second one
List you can mess up as it allows duplicates, Set doesn;t
however, Blocks are unique, so
I trust my code not to mess up so it wouldnt add duplicate blocks
In CraftPathfinder i guess
have a block position class and override its hash and equals methods
then use that in a set
if you make it immutable then you get a small performance boost too in some situations afaik
im not trynna make it complicated
For curiosity, is there a neat event that detects when cobblestone is generated from flowing lava and water?
Yes
i think its bugged tho
thats not a good idea
just use a set its guaranteed not to mess up
unless you wanna play program correctness with java code which is not fun
thanks for the ideas guys, ill get to codin more with this 😄
yo why is terracotta not Directional?
Ah. Cool...
Maybe its Orientable
normal or glazed?
Normal terracotta?
I think they are aligned by axis and not ordinal direction
wait I didn't say anything shh
Glazed Terracotta is directional :p
is there a difference?
bukkit api implements it just fine, it's the mc wiki that isn't updated
smh my head
which wiki?
regular fandom
ah
hello i'm asking about how to add tags for players like this
https://prnt.sc/1rbriss
i tried player.setCustomName("[Tag]");
but no works
if i used scoreboard teams they will give the same tag for all players on team
I think then its time to search for errors in the dependency manager.
Do you re-obfuscate the jar?
I do, yes
BlockFace.UP + BlockFace.DOWN -> Y-Axis
ahh right
Try not to. This means your plugin would only run with a moj mapped jar for once but the error could be in there
as Pose might be resolved weirdly
Just to rule it out
Because it works with a bog-standard spigot jar
I mean if you dont re-obfuscate it. Then it will only run with a mapped jar.
right
Try removing the remap goal and see if it compiles without it
Nope
No change
What wonders me is why the error is apperantly caught in the interface
Not the spigot entity or the nms one
But it just points to the beginning of the file
Ok, I have narrowed it down
When I stub the Interface, it works
Which interface? Pathfinder? What do you mean by "stub"? I just know this term from unit testing.
Like a mock impl
Yes, the pathfinder interface
And by stub, I mean comment out the entire body of the interface
Do note, the mob extension remains
Did your Pathfinder import nms Pose?
Nope
Infact, the only nms stuff stuff it imports is PathNavigation and Path
Which is unrelated to poses
Did you try commenting out methods?
does anyone that knows citizensapi know why this error is happening?
[19:16:03 ERROR]: Could not pass event PlayerInteractEntityEvent to Dirtlands v1.0
java.lang.IllegalStateException: no implementation set
at net.citizensnpcs.api.CitizensAPI.getImplementation(CitizensAPI.java:70) ~[Dirtlands.jar:?]
at net.citizensnpcs.api.CitizensAPI.getNPCRegistry(CitizensAPI.java:103) ~[Dirtlands.jar:?]
at net.dirtlands.listeners.shopkeepers.Shopkeeper.playerInteractWithEntity(Shopkeeper.java:27) ~[Dirtlands.jar:?]
...
the error happens here:
if (!CitizensAPI.getNPCRegistry().isNPC(e.getRightClicked()))
I heard that it's because citizens needs to fully load first, but i have it as a dependency in my plugin.yml ([WorldGuard, LuckPerms, ProtocolLib, Citizens]) and i even put a scheduler around the line that i register the event (which apparently waits until the first tick of the server to run)
AHA
So it is the spawn method
static Pathfinder spawn(Location loc) {
return new CraftPathfinder(
((CraftWorld) loc.getWorld()).addEntity(
new PathfinderMob(((CraftWorld)loc.getWorld()).getHandle()),
CreatureSpawnEvent.SpawnReason.CUSTOM,
(e) -> e.teleport(loc),
false));
}```
First: Citizens is utter garbage.
Then call
CitizensAPI.getNPCRegistry()
in your onEnable once
hahaha yeah i was using nms before and it got too painful and i just said screw it im using citizens
Ok thats nice. Now you only need to decide if you want to move this method or keep it and find out why its causing such trouble...
hey there yall. Having a bit of an issue trying to use getResourceAsStream() to read files in the minecraft.jar. Any tips?
The JavaDoc is less than helpful, maybe I'm reading it wrong.
?paste
What do you need the stream for?
I'm trying to get the JSON files readable as Strings, almost like this;
Specifically the loot tables.
Ok but for what purpose? Gson can read from a Stream.
I'm going to use the Strings to create a simplified version of the loot table in an inventory so the player can view them without having to read the JSON file.
ok cool tysm im not getting errors i just messed something up with some if statments for now but not a big deal
?
I'm just having trouble using getResourceAsString(), I don't seem to understand what I'm supposed to set to else?
oh nevermind it happened again
[20:20:47 ERROR]: Error occurred while enabling Dirtlands v1.0 (Is it up to date?)
java.lang.IllegalStateException: no implementation set
at net.citizensnpcs.api.CitizensAPI.getImplementation(CitizensAPI.java:70) ~[Dirtlands.jar:?]
at net.citizensnpcs.api.CitizensAPI.getNPCRegistry(CitizensAPI.java:103) ~[Dirtlands.jar:?]
at net.dirtlands.Main.onEnable(Main.java:32) ~[Dirtlands.jar:?]
CitizensAPI.getNPCRegistry();
Simplest way would be to just save them to disk and read them from there.
But here is a simple approach to getting the String from a json stream.
private final Gson gson = new GsonBuilder().disableHtmlEscaping().create();
public String toJson(final InputStream inputStream) {
try (final InputStreamReader reader = new InputStreamReader(inputStream)) {
final JsonObject jsonObject = this.gson.fromJson(reader, JsonObject.class);
return jsonObject.toString();
} catch (final IOException e) {
e.printStackTrace();
return null;
}
}
How would I be getting the information as a Stream? Do I call it using the NamespacedKey?
@Override
public void onEnable() {
InputStream isr = this.getResource("theFile.json");
}
Just make sure to not let the stream hanging
This is my first time really using streams, so I have no idea what that means.
Use it right away.
Ah ok, it'll be getting used moments after the call. Thanks for the heads up.
Is there a means of using the NamespacedKey functions to get the file name as a .json file? So far I've been able to get minecraft:entities/mobname but I don't know what I'd do from there.
Wait. You want to get those json files from your own jar, right?
i think i put the wrong version in my gradle file so ill try again
Nope, the minecraft.jar would be ideal.
This will be a bit more complicated... Not witchcraft but still.
Everything is witchcraft, but I'll try my best lol
Any reason why you dont want to use the loot table API from spigot?
The loot table API doesn't seem to have any means of accessing the weight, min/max, or special lore about the items.
The API will not allow you to list items and weights
Loot Table API seems to just be for filling chests.
can some one help please
rectangle or circle would be great thanks! Im using your workload system, its amazing
both of them would make the game better so yeah
A square is quite easy.
public List<Block> getSquare(final Block middle, final int radius) {
final List<Block> blockList = new ArrayList<>();
for (int x = -radius; x <= radius; x++) {
for (int z = -radius; z <= radius; z++) {
final Block relativeBlock = middle.getRelative(x, 0, z);
blockList.add(relativeBlock);
}
}
return blockList;
}
A rectangle would be
public List<Block> getRectangle(final Block middle, final int xWidth, final int zWidth) {
final List<Block> blockList = new ArrayList<>();
for (int x = -xWidth; x <= xWidth; x++) {
for (int z = -zWidth; z <= zWidth; z++) {
final Block relativeBlock = middle.getRelative(x, 0, z);
blockList.add(relativeBlock);
}
}
return blockList;
}
could we go in dm's so you could help me on actually implementing this?
This would make a list of blocks all fall down instantly:
public void letFallDown(final List<Block> blockList) {
for (final Block block : blockList) {
final BlockData data = block.getBlockData();
block.setType(Material.AIR);
final World world = block.getWorld();
world.spawnFallingBlock(block.getLocation().add(0.5, 0, 0.5), data);
}
}
i have a method on the server start that saves all the locations of each block of the terrain
won't this lag players?
how do i connect to sqlite database ?
Only if the area is rly big.
JDBC
100 players
xd
biggest server in italy so yeah the map is very big
i know but the map is very big
You could make it so only one block per tick falls 😄
that would also make a smooth effect ⭐
How do I find every mob tamed by player X?
You can only do that for mobs that are currently loaded.
I mean you could do it for every mob even in unloaded chunks but
thats quite the task
We can converse about this tomorrow. Im going out now.
on the start of the server i have this method that loads every location that is between the two corners that have been set in the config https://paste.md-5.net/burucaxuli.cs
oh ok, sure, thank you anyways!
Hello, there is a way to hide all optifine and mojangs capes? it is possible?
How though?
Q: (I know nothing when it comes to plugins) is it possible for a plugin to modify the contents of another plugins folder?
yah it is
well, not always, but in most cases, yes
We have a plugin, advanced Chests, it doesn't have a native repair function for stuff like swords as we mainly use it for auto selling so a repair to sell gold swords would be great and I did mention it to the dev but they seemed a bit iffy about it
No.
?
Please post in the correct channel.
It's a development question thus I posted it here, where should have I?
This is the right place ignore him
it is mostly the correct channel
Yeah idk if this guy is also yet another alt from those recently banned people
Oh okay I was going to say if I am worng I will gladly move
No need 👍
Anywho I'll look more into it when I get home as I'm at work, at least ac dose provide some sort of API so I may be able to use that
when i want use Long2IntLinkedOpenHashMap i have error in console [23:17:54 FATAL]: Failed to schedule load callback for chunk [0, 0] java.util.concurrent.CompletionException: java.lang.NoClassDefFoundError: org/bukkit/craftbukkit/libs/it/unimi/dsi/fastutil/longs/Long2IntLinkedOpenHashMap how can i fix that?
What version is the server running on, and what version do you compile against?
Is there a way to teleport someone without effecting their momentum? Like can I just move somebody up 0.3 blocks and have their motion remain the same
server version 1.17.1, but compile version 1.16.5, it may be issue?
ok, i check this
Doesn’t teleport do this?
Like the normal teleport method
Actually i think I might've said the wrong thing
It keeps momentum
But like if a player is pressing W, they only start moving in the air which obviously means they don't have the same momentum
What about getting their velocity before and applying it after the teleport?
Doesn't make a difference
Like if someone is pressed up against a wall holding foward and they get teleported i want them to move foward
So is there a way to check if a player is holding foward?
Don’t think
still the same error :/ -> full crash report
i was about to say, what do you need a paste for, are you on mobile? then i checked your status
still kinda stupid how discord doesn't embed stuff right on mobile
Yeah
that and how fucked up conversations are on android are just textbook examples of how little discord cares about mobile
What did u change btw?
lmao yeah
Their development progress certainly isn’t the most effective one imo
// You're mean.
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot</artifactId>
<version>1.17.1-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>``` and from java version 1.8 to 16
and api ver in plugin yml
And ur server version?
^^ probably just a missing relocation on papers end
i can't see how that changed anything
that classic paper jank
and plugins using paper api won't work on spigot, right?
paper api is pretty good it's just weird in execution
it might break off from spigot eventually
Hello I have a issue with bungee cord
i think breaking compatibility with spigot plugins is a good price to pay for efficiency and not having weird work arounds
How can I fix this? Is there a other way to fix it?
you cant extend a final class
But why did it work in the source code of them?
?
Asking about your attempted solution rather than your actual problem
what are you trying to do
I copied this class because the vid said paste this in it
well following a video is your first issue what does the class aim to do
ComponentBuilder is final for a reason
?
Why is it final?
Because in his code it worked perfectly
I’m coding in 1.12 and he’s coding in 1.8 or lower Idn
You answered your own question
java go brrr
following tutorials where you just copy line for line isn't exactly the best idea
what are you trying to do
i can advise you a better way to do it
or at least try
?ask @zinc plover
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. Create a thread in case the help channel you are using is already in use!
i have a problem to read out of my config if a special value already exists
can somewone help me with this and show me how i can do that
?
getConfig().isSet(path)
I afraid you provided not enough details about your problem. Can you share your code and what you expect it to do?
i want to create a if what is asking if this value exists in the config
getConfig().isSet(path)
and then == value
.equals
ah ok
wait what?
thanks bro
getConfig().isSet(path) returns a boolean
ah ok so i must integrate what i am searching in the path
you asked how to test if a value exists
yes
he told you
isSet will tell you if there is a value in your config under that path
you then get to see what the value is
yes exactly i want to know whether this value already exists for this path
I just told you how
erm is there a way to run a specific method with a specific interval
?scheduling
and the interval's duration depends on a condition
?scheduling
lol
i cant put a variable in the interval...
lol
^
getter works too ^
MutableLong maybe
AtomicMutableMemorySpringLongImpl

nice name
thanks guys it worked
thanks it worked
can i add players to the config like this
1:
-Viereckig
-Elena
use UUID not name
player.getUniqueId()
ok but i want to save multiple players at 1 how can i do that
a List
arraylist?
sure
is there a way to compactly register/unregister listeners without hardcoding objects
is that normal that it saves UUIDs in the config like this
!!java.util.UUID 'b305ad03-35bb-421f-8d93-52cbe30bb88c'
if you save the object directly then yes
but that will not load
there is no registered deserializer for uuid by default i believe so you should save as string instead
can some one help please
does anyone know why this wont work? ```if (event.getDamager() instanceof Player) {
Player damager = (Player) event.getDamager();
if (damager.getInventory().getItemInMainHand().getEnchantments().containsKey(Enchantment.getByKey(VenomousRegister.VENOMOUS.getKey()))) {
Mob victim = (Mob) event.getEntity();
victim.addPotionEffect(new PotionEffect(PotionEffectType.POISON, 5, 1, true, false, false));
}
}
}``` it doesnt add **poison** to the _victim/mob_
read the docs or get a plugin
setCustomName it's their Nickname
can someone help me??
(getBlock().getBlockData() instanceof Leaves)
This should work right?
i think so
Can't seem to get it work. I'm setting the persistence right that after and the leaves still decay.
idk then
Tag.LEAVES.isTagged(block.getType())
does anyone know why this wont work? ```if (event.getDamager() instanceof Player) {
Player damager = (Player) event.getDamager();
if (damager.getInventory().getItemInMainHand().getEnchantments().containsKey(Enchantment.getByKey(VenomousRegister.VENOMOUS.getKey()))) {
Mob victim = (Mob) event.getEntity();
victim.addPotionEffect(new PotionEffect(PotionEffectType.POISON, 5, 1, true, false, false));
}
}
}``` it doesnt add **poison** to the _victim/mob_
debug code it
Oh shoot. Got to set the BlockData after. I'm dumb.
debug code??
Yes code to show where it goes wrong
its this message thats the code
Yes, so after every if statement, print a message to console to see if its being run
so like send a message every statement??
That's also gonna throw a NPE if you attack without an item in your main hand.
what is an NPE?
is it like an error message?
Yes it will send an error message to console if you are not holding anything
how do i prevent that??
Also, how do you know how to code what I assume to be custom enchants but don't know what a NPE is?
i have no idea why i didnt know what an NPE was
also i did debug the code and it does send the message
how do i prevent that?
so you put a print line after the addpotioneffect line?
i forgot that it was ticks and not second....
there is an error message in the console when the server starts like about the listeners how can i prevent that?
Well can I see it?
can i dm you a screenshot?
Sure
is it possible to make one inventory (gui) to open to multiple people instead of make 1 per person
yeah but in the tutorial i saw, they did like Bukkit.createInventory(args) with a player as the first argument
no thats for blocks and stuff
inventoryholders to be exact
the first arg for creating a custom inventory should be null
Could someone help me with this problem? 😄
https://www.spigotmc.org/threads/cancel-fall-damage-event.524659/
dont keep a list of players
it should be List<UUID>
also
List<T> myList = new ListImplementation<>();
in this case
List<UUID> flyingPlayers = new ArrayList<>();
Hey can any1 help me please? Im trying to create a random class chooser. Im trying to create a minecraft manhunt minigame and am trying to create a randomizer on who is the speedrunner and make everyone else the hunter.
You can use Java's Random class to return a random integer between 0 and 1, and then iterate through each player, if Random returns 1, then you make that player the speedrunner and everyone else the hunter.
there are better ways more efficient
get a list of all the players select a random user from the list using javas random class assign that player to be the speedrunner and then everyone else can be hunters
true
in that case
You can generate between 0 and the last index of the List (players.size - 1 I think?), then just players.get(myRandomInt)
ok
the upper bound is exclusive
you want the size not the last index otherwise some poor player won’t ever get to be the runner lol
eh, fuck him
reminds me of my Murderer chances on Murder Mystery tho lmao
i would start off with something simpler than hunter vs speedrunner if its ur first time
just try making fun commands and some event listeners that do wacky things so you can get a grip of how to make them
then once you are ready apply all the knowledge to create an event like hunter vs speedrunner
actually I'd argue Manhunt is a pretty easy gamemode to get working
it deff is one of the easier ones but if u havent done anything before its probably best not to do any gamemodes as a first plugin
I guess that's fair
i mean it depends how you learn really
but you shouldnt expect us to spoonfeed you all the answers
or code anything for you
So any tips becuase Ive never worked with java before. I have used lua tho
uhh, do you at least know Java?
A bit
That's a good start. I don't have much advice to give in-general, but if you need help with something specific you can go ahead and ping/message me.
I would reccomend following some guides or tutorials for spigot before you start making your own plugins
Ok
Codedred on YouTube has some great tutorials
No
Yes, but no
Huh
just follow the tutorials
ok
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.
Ok
ZoiBox doesn’t know anything so we bully him everytime
If I have added a command by altering the command map directly by code, is it still possible to set a tab completer for the command? I tried to do it by getCommand().setTabCompleter() but that just caused NPE
Hey guys. I've been trying to make an ability that involves shooting out an item from the player as if they had dropped it, but multiplying its velocity to increase its speed. However, no matter what approach I take to the situation, the item almost always seems like it's shooting out from the center of the player...
Here's a video of the item launching aspect in action:
Here's the code used to drop the item (in its current state):JAVA Item droppedItem = player.getWorld().dropItem(player.getLocation(), item); Location eyeLoc = player.getEyeLocation(); droppedItem.setVelocity(eyeLoc.getDirection().normalize().multiply(0.7));
OHHH
whoops
lmao
should move the eyeLoc line up so I can use it in the spawn line as well though
Yes
so so far I made it so you could mount dolphins underwater and that my custom dolphins replace regular ones
but
slight problem
how do I make the player control it
set the dolphin's direction to the player's direction?
Maybe?
try it
could be an easy fix
You would also have to set the dolphin's yaw and pitch to the player's yaw and pitch
how would I do that?
You would utilize the Location#setDirection and Location#getDirection methods in order to get and set directions
For yaw and pitch, you would want to use Location#getYaw and Location#getPitch
ohh ok tysm
I know yaw and pitch might sound complicated if you don't know what it is yet, but it's really just two rotational factors
Sorry, but I need to leave now, so if that quick solution doesn't succeed, you'll have to work out another one on your own.
so might dolphin replacing thing is quite janky so how would I make it so that dolphins are replaced with my dolphin
im using entityspawnevent
who helps me create a server with all the plugins for Prision OP? please
not the place for this
ok
What's the best way to "enable" features based on the server version? Like, what I'm doing involves blocks. So I want to have this so it could check for a minimum server version and go from there for each set of blocks, with each set being the new blocks added in a major version
may i ask, what do you use to record your screen like that?
if you answer, could you dm it to me, im about to go to bed, thx
you could probably set the X/Y coordinates in OBS
Yeah don't worry, I think most people realize this after their first or second encounter with him.
SQLite statement
ALTER TABLE players RENAME TO old_players
apparently returns a query?
PreparedStatement ps = c.prepareStatement("ALTER TABLE players RENAME TO old_players");
ps.executeUpdate();
[12:26:51 WARN]: java.sql.SQLException: Query returns results
But for the MySQL connection it is fine, it doesn't error. Is the fault on my end or on the jdbc itself?
prob cant have the table named table
Oh that's just a sample. I have it named something else completely
Tried that, still the same thing
Currently have the workaround if (m.version.equalsIgnoreCase("sqlite")) ps.executeQuery(); else ps.executeUpdate();, it works, but I'm not confident about it, plus it looks ugly
odd
syntax looks fine, you don't need the TO there but not sure if that would do shit
Yea you need the TO I think, if you wanna rename table name itself
Does anybody know why NMS that was working on all versions is not no longer working on 1.17?
Any quick fix? I noticed some of classes moved...
red the thread linked in #announcements
im trying to make a server chat bot any idea how to make it?
what kind of chatbot
minecraft for discord
The easiest way is just to use a java wrapper for the discord api and hook that
im also trying to use git bash but whenever i put the command from the spigot downloading it says please do not run this path with special characters
@chrome beacon
So don't run it in a path with special characters
Send path
Either
yeah but i need to make it so you cant boop yourself
?paste
@chrome beacon dms
How can i run my plugin in a new Thread?
new Thread(() -> {
//TODO
}).start();
How can i start a schedular in a new thread?
does any know why my command don’t work? ```@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
if (command.getName().equalsIgnoreCase("redeem")) {
if (sender instanceof Player) {
Player p = (Player) sender;
p.sendMessage(ChatColor.AQUA + "test 2");
}
}
return true;
}```
it dose nothing
plugin.yml ```name: codes
version: '${project.version}'
main: net.picklestring.codes
api-version: 1.17
authors: [ Pickle ]
description: Codes!
website: picklestring.net
commands:
redeem:
description: Redeem a code
usage: /<command>
did you register it
"register" - set the executor
thats in my main class do i still need to?
is there an error in your console?
how do i check if an advancement is, well, an advancement, instead of a recipe?
you probably have to, yes
no
ok ill try
what function do i do it in?
onstartup?
onEnable i mean
yes
ok
you must register your command class in the onenable
thx
and also in the plugin.yml
in the class or in main class?
How to check if advancement isn't recipe?
you go in the main class to the onenable methode
ok tysm
getCommand("command").setExecutor(new ClassnameofCommand());
you write this in your Main onenable methode
tyssm
still didn’t work 😦
How to make armorstanf mount displayname and rorate ?
How do you write a list in a yaml config?
key:
- "Like this?"
key2:
- "Or like this?"
both are allowed
I like second more though
add 180
well, it doesnt really make much sense for 2 vectors which cross each other to have an angle more than 180
well, if u want 270, add 180 xd
angle just gives the angle between the two vectors, if u have to rotate 270 degrees then u add 180 kek
does anyone know how to set the damage delay for a player to a millsecond and how to set the attack delay (like the crit delay) to a millesecond too?
What is the best way to stop explosion damage with tnt?
I spawned the TNT so i have access to the Entity Object but i didnt really see a method under TNTPrimed
ive tried saving bed parts manually and then resetting them but i cant get it to work as both beds and up being bottom parts. does anyone know how to do this properly?
Thanks for your answer
anyone has an updated way of having a cooldown for commands?
hashmap with player and task or integer to count down
ok thanks
Well, what are you trying to achieve
can anybody tell a plugin through which blocks drop random item
Don't ask here. Stay in #help-server
ok
Stupid question, But what will be the reason an iron golem target zombies or skeletons?
Their TargetGoalSelector. One of them causes a nearby undead to be targeted.
I decided to not use NMS 😂 It was too much for my brain lol
Dont use an active count down. Use a timestamp when the player used the command and check the time diff each time he tries again.
I think there is an event that is fired when an entity changes targets. Maybe that helps.
I'm using that... And trying to filter targets based on reasons...
I want the zombie act like a tamed animal
so just cancel the EntityTargetEvent and use #setTarget(Entity) if the player is attacking another animal
What is the default value of Attribute.GENERIC_ATTACK_DAMAGE for a Wolf ?
depends on the difficulty
The zombie acts like a wolf, But that stupid iron golem in village keep attacking him
Ok for normal then
I think 4
Check minecraft wiki
I did, but if I set it to 0.2 they will one-shot any player
And If I cancel all targeting (if the target or entity is my zombie) it will make other mobs do not fight back 😦
Weird. Do you set the base value?
so check in the event if the entity is an iron golem and if so, check if the target is a tamed zombie
setBaseValue on AttributeInstance
How about printing the value and see what it has???
public class Custom_cat extends EntityCat {
public Custom_cat(EntityTypes<? extends EntityCat> entitytypes, World world, Location loc) {
super(entitytypes, world);
this.setPosition(loc.getX(),loc.getY(),loc.getZ());
this.setCustomName(new ChatComponentText(ChatColor.GOLD + "MEOW"));
this.setCustomNameVisible(true);
this.setHealth(1000);
}
i been working on a custom mob, is there a way which i can change the ai to a baby zombie
- Naming conventions.
CustomCat - Dont clutter your constructor with all those arguments.
public class CustomCat extends EntityCat {
public CustomCat(final Location location) {
super(EntityTypes.j, ((CraftWorld) location.getWorld()).getHandle());
this.setPosition(location.getX(), location.getY(), location.getZ());
this.setCustomName(new ChatComponentText(ChatColor.GOLD + "MEOW"));
this.setCustomNameVisible(true);
this.setHealth(1000);
}
}
@chrome pewter
Can sime one give me a example code for run a bukket runnable in a new thread?
Do you want to start a BukkitRunnable from another thread or
do you want the BukkitRunnable run on another thread?
The second
Here are 4 examples
JavaPlugin plugin = ...;
Bukkit.getScheduler().runTaskAsynchronously(plugin, () -> {
// Do some stuff
});
JavaPlugin plugin = ...
Bukkit.getScheduler().runTaskAsynchronously(plugin, this::someAction);
}
private void someAction() {
// Do some stuff
}
JavaPlugin plugin = ...
new BukkitRunnable() {
@Override
public void run() {
// Do some Stuff
}
}.runTaskAsynchronously(plugin);
public class CoolTask extends BukkitRunnable {
public CoolTask() {
// Add stuff
}
@Override
public void run() {
// Run something
}
}
------------------------------------------------------
JavaPlugin plugin = ...
new CoolTask().runTaskAsynchronously(plugin);
anyone knows if is it possible to remove this speed limit? when I sprint & jump on a pressure plate (launchpads plugin) I get too fast and i get a teleport bug in game and this warning in the console:
[13:26:09 WARN]: Excessive velocity set detected: tried to set velocity of entity #260541 to (0.21773703415135898,1.8,-4.427639896930246)
You cant unless you use NMS
And even then you shouldnt
AttributeModifier.Operation I don't understand what those do, who can explain?
the only other option I have is to set a maximum velocity, do u know whats the max value it can have?
But how on a new thread. But thenkas that are really good examples
ADD_NUMBER
Given value X and base Y
Result will be X + Y
MULTIPLY_SCALAR_1
Given value X and base Y
Result will be Y * (X + 1)
ADD_SCALAR
Never used it but i guess its Y * X
thank you
Thanks for the explanation!
???
If you want true new threads then just use any of the java methods to spawn a new thread.
Maybe this helps:
https://www.spigotmc.org/threads/guide-threading-for-beginners.523773/
This is really hard to achieve and requires a lot of digging in NMS.
i am using nms
Alright then search in the EntityZombie class and pick out everything you need.
do you think my answer will be in pathfinder
thank you
Another stupid question, What event manages Entities despawning??
hello
i have an error soo i was wondering if someone could help i am making a plugin
To be honest. Its probably better to just use LibsDisguises and spawn a zombie that is displayed as a cat...
?ask
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. Create a thread in case the help channel you are using is already in use!
You probably should send your error 🤷
ok
Cannot invoke "org.bukkit.command.PluginCommand.setExecutor(org.bukkit.command.CommandExecutor)" because the return value of "com.redberry.sweet.Sweet.getCommand(String)" is null
at com.redberry.sweet.Sweet.onEnable(Sweet.java:14) ~[?:?]
at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:263) ~[spigot.jar:3096-Spigot-9fb885e-296df56]
at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:342) ~[spigot.jar:3096-Spigot-9fb885e-296df56]
at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:480) ~[spigot.jar:3096-Spigot-9fb885e-296df56]
at org.bukkit.craftbukkit.v1_16_R3.CraftServer.enablePlugin(CraftServer.java:492) ~[spigot.jar:3096-Spigot-9fb885e-296df56]
at org.bukkit.craftbukkit.v1_16_R3.CraftServer.enablePlugins(CraftServer.java:406) ~[spigot.jar:3096-Spigot-9fb885e-296df56]
at net.minecraft.server.v1_16_R3.MinecraftServer.loadWorld(MinecraftServer.java:554) ~[spigot.jar:3096-Spigot-9fb885e-296df56]
at net.minecraft.server.v1_16_R3.DedicatedServer.init(DedicatedServer.java:257) ~[spigot.jar:3096-Spigot-9fb885e-296df56]
at net.minecraft.server.v1_16_R3.MinecraftServer.w(MinecraftServer.java:928) ~[spigot.jar:3096-Spigot-9fb885e-296df56]
at net.minecraft.server.v1_16_R3.MinecraftServer.lambda$0(MinecraftServer.java:273) ~[spigot.jar:3096-Spigot-9fb885e-296df56]
at java.lang.Thread.run(Thread.java:831) [?:?]
my pplugin.yml
Make sure your command is properly written into the plugin.yml
name: Sweet
version: 1.0
author: Redberry
main: com.redberry.sweet.Sweet
api-version: 1.16
givewand:
description: Gives creeper wand to play.
usage: /<givecreeperwand>
this is the plugin.yml
Sweet line 14 pls
idk what ur talking about
name: Sweet
version: 1.0
author: Redberry
main: com.redberry.sweet.Sweet
api-version: 1.16
commands:
givewand:
description: Gives creeper wand to play.
usage: /<givecreeperwand>
line 14 of sweet class...
Sweet.class
line number 14
post it
getCommand("givecreeperwand").setExecutor(new SweetCommand());
Here is your solution
Also you dont have any "givecreeperwand" command in your plugin.yml
this
Also ```
getCommand("givewand").setExecutor(new SweetCommand());
i do
No you dont
oh does it have to be give wand
The names do not match
it has to be the exact names..
They must match
commands:
givewand:
description: Gives creeper wand to play.
usage: /<givewand>
Dont forget the commands sections
and on my line 14 i have the ("givecreeperwand") soo do i change it to ("givewand")
Hmm, I have a map of creatures to some data, How can I remove data when the creature despawns??? Is there any event??
Yes
You can either change your plugin.yml or your Sweet.class
ok
Is there a reason why you dont just write the data in the PersistentDataContainer?
/<givewand> this is what i should put on my plugin.yml right
The usage is irrelevant. What matters is the path
I don't know why 😂 It's a linkage map... May be because I need to access the creatures often
ok and if i add more wands what do i do then
Make sure the names matches
oh soo on usage could i do /<givewand creeper>
Did they remove goalSlector in nms
Your command could just have a type argument
So
/givewand creeper
/givewand lightning
etc.
This way you only need to register the givewand command and do everything else in your CommandExecutor class.
ok thanks
No. Again: The usage is irrelevant
ok
still getting an error
Error occurred while enabling Sweet v1.0 (Is it up to date?)
java.lang.NullPointerException: Cannot invoke "org.bukkit.command.PluginCommand.setExecutor(org.bukkit.command.CommandExecutor)" because the return value of "com.redberry.sweet.Sweet.getCommand(String)" is null
at com.redberry.sweet.Sweet.onEnable(Sweet.java:14) ~[?:?]
at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:263) ~[spigot.jar:3096-Spigot-9fb885e-296df56]
at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:342) ~[spigot.jar:3096-Spigot-9fb885e-296df56]
at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:480) ~[spigot.jar:3096-Spigot-9fb885e-296df56]
at org.bukkit.craftbukkit.v1_16_R3.CraftServer.enablePlugin(CraftServer.java:492) ~[spigot.jar:3096-Spigot-9fb885e-296df56]
at org.bukkit.craftbukkit.v1_16_R3.CraftServer.enablePlugins(CraftServer.java:406) ~[spigot.jar:3096-Spigot-9fb885e-296df56]
at net.minecraft.server.v1_16_R3.MinecraftServer.loadWorld(MinecraftServer.java:554) ~[spigot.jar:3096-Spigot-9fb885e-296df56]
at net.minecraft.server.v1_16_R3.DedicatedServer.init(DedicatedServer.java:257) ~[spigot.jar:3096-Spigot-9fb885e-296df56]
at net.minecraft.server.v1_16_R3.MinecraftServer.w(MinecraftServer.java:928) ~[spigot.jar:3096-Spigot-9fb885e-296df56]
at net.minecraft.server.v1_16_R3.MinecraftServer.lambda$0(MinecraftServer.java:273) ~[spigot.jar:3096-Spigot-9fb885e-296df56]
Here is what i got so far. I think there is only one problem left
https://gist.github.com/Flo0/05fb975cb7f3cf58b2fdbc58d00e36e6
thank you so much, you help so much
Show your plugin.yml and your Sweet.class line 14 again pls
if its getting to crowded then if u want i could show u in dm
Nope. All good. Just post it here so multiple ppl can see it / help
just a sec
my line 14: getCommand("givewand").setExecutor(new SweetCommand());
my plugin.yml: name: Sweet
version: 1.0
author: Redberry
main: com.redberry.sweet.Sweet
api-version: 1.16
givewand:
description: Gives creeper wand to play.
usage: /<givewand>
what
ok i got it
can i add change /givewand to /givewand creeper
just reply with yes or no
Nope. You need to do that in your CommandExecutor
ok
this line : if (cmd.getName().equalsIgnoreCase("givewand")) {
this is in my SweetCommands
class
How to rorate armorstand head follow yaw pitch body player?
P/s: while mounting displayname
Here is an example:
public class SweetCommand implements CommandExecutor {
@Override
public boolean onCommand(final CommandSender commandSender, final Command command, final String label, final String[] args) {
final int argumentCount = args.length;
if (argumentCount != 1) {
commandSender.sendMessage(ChatColor.RED + "You need to specify one argument.");
return true;
}
String firstArg = args[0];
if (firstArg.equals("creeper")) {
// Give creeper wand
}
return true;
}
}
if (cmd.getName().equalsIgnoreCase("givewand")) { <- This does nothing unless you use the same CommandExecutor for multiple commands.
omg thank u soo much it worked
thanks u fixed the error
Plss help me 😦
ArmorStand armorStand = ...
Player player = ...
Location delta = player.getEyeLocation().subtract(armorStand.getEyeLocation());
double tanBearing = Math.atan2(delta.getZ(), delta.getX());
armorStand.setHeadPose(new EulerAngle(0, 180 - tanBearing, 0));
This should at least cover the yaw. Ill let you figure out the pitch yourself.
can i adjust y position of armorstand while mounting?
Yeah I’d use the mojang mappings in the dev env to speed stuff up
You can get gradle or maven to map back to normal
Can someone help me please. I get this error when trying to run eclipse:
ok
And I also cant find the download for the new JVM
I have java 16 downloaded
so use that for your project/IDE
Is it possible somehow to mute certain messages from sending in the console? In particular I don't want to see these messages in the console....
[15:21:27] Disconnecting com.mojang.authlib.GameProfile@00000000[id=00000000-0000-0000-0000-000000000000,name=<NAME>,properties={textures=[com.mojang.authlib.properties.Property@00000000]},legacy=false] (/000.0.0.0:00000): You are not whitelisted on this server!
Does it make sense to assign null to all objects of my plugin in onDisablePlugin event in order to invoke garbage collector?
ConsoleSpamFix on spigot
Well if another plugin is hard referencing let’s say, your CachedUserManager, then it might not get gcd and instead a leak might be the case
ok, that make sense
Tho I don’t know whether something like paper might reflectively unset and resolve that, in which case it would be safe more or less.
Anyways you should let other plugins depend on an api of yours to gain control over this.
once the plugin is disabled its unloaded
the garbage collector will get it all
if its still running?
Necessarily not
^
If we assume another running plugin is still hard referencing something in the disabled plugin, that instance cannot be garbage collected.
Yes, however I would like to learn how to do it, or how they did what they did :)
its a 13kb jar
look at the code
just decompile it
all it does is catch sysouts
the github isnt available
?
they didnt make it open source
menace
wait thats a thing? How can I do that :P
open it with intellij
Just saying, there is no point of hiding console messages really
idk why you would want to avoid the spam
Unless it gets spammed with command block execution logs lol
it's not really about hiding them, more about replacing them with a more readable messages
what..
when I see that message in console, it's hard to see at a glance who tried to join the server. If that message could be replaced with something like "<Name> tried to connect while not whitelisted" would be a lot cleaner, you know?
You lose debug information such as whether they are authenticated or not, their IP Address if they were IP Banned the first place, their UUID
its not worth it
I mean I could add all that info into the message if I wanted...
Worth it or not, it would be nice to know how to do it :)
Can i run a event in a new thread?
You can call an event in a new thread. Almost all spigot events will break this way.
So thats only an option for natively async events or your own.
How can i do that?
Just
Bukkit.getPluginManager().callEvent(event);
From another thread context.
What are you trying to do?
ooh, cool
I start a scheduler when a player joins and write hist positions to a txt file every 30 seconds
i wonder would it would be like if spigot were multi threaded
a bit like paper, just even better
And i do not want to make my server a lag machine when i make that in the main thread
And why do you need an event for that?
Because it has to start when a player joins
multi-threaded paper
?scheduling
But why do you need to fire an event for that?
You can just listen for the PlayerJoinEvent and then add him to a List or something.
I meaned a listener
PlayerLocationTracker class:
https://gist.github.com/Flo0/06972ef75ff54f6f0f6b3d537268ed11
@Override
public void onEnable() {
PlayerLocationTracker.start(this);
}
Results in:
@manic furnace This is the simplest approach.
Just get all players online async every N seconds and write their position to a file.
Bukkit.getOnlinePlayers() should be thread safe.
I have a moved how to do that.
But how can i listen to a event and execute the listener in a new thread?
I dont understand what that even means...
You can listen for any event like normal and then start a new thread inside the listener method.
I tried that but when i out print the thread it is the server thread
This is how you start a new async task per player when he joins.
When the player leaves you need to stop the task again.
TrackerTask has to be your own Runnable implementation.
public class PlayerLocationLogListener implements Listener {
private final JavaPlugin plugin;
private final Map<Player, BukkitTask> playerBukkitTaskMap = new HashMap<>();
public PlayerLocationLogListener(final JavaPlugin plugin) {
this.plugin = plugin;
}
@EventHandler
public void onJoin(final PlayerJoinEvent event) {
final Player player = event.getPlayer();
final TrackerTask trackerTask = new TrackerTask(player);
final BukkitTask bukkitTask = Bukkit.getScheduler().runTaskTimerAsynchronously(this.plugin, trackerTask, 0, 600);
this.playerBukkitTaskMap.put(player, bukkitTask);
}
@EventHandler
public void onQuit(final PlayerQuitEvent event) {
final Player player = event.getPlayer();
final BukkitTask bukkitTask = this.playerBukkitTaskMap.remove(player);
bukkitTask.cancel();
}
}
i would do a global task
🥄
with a simple object or map to store the last storage
Yes. Thats what ive proposed earlier. But he explicitly wants one task per player.
task per player is probs safer anyways. That way if he gets to many players the tasks are spread out
How do i make a paper-spigot plugin in 1.8.8?
Dont. 1.8 is very outdated and support was dropped almost half a decade ago.
let they use 1.8
No. People clinging to ancient versions keeps the API from progressing.
Ye but i wanna make something like as in hypixel but thats in 1.8 i think.
they dont care about api
Yes but i do.
you can run both client and server with only 512mb of ram
I want the API to not be forced to support versions that are older than the people using it.
But then how would i make my server run on 1.8? if i cant use 1.8 to code?
you can also just use ViaBackwards https://github.com/ViaVersion/ViaBackwards
ye but i kinda also want the 1.8 pvp and all the plugins that exist for that are very buggy
allows you to run the latest server software but people from older versions may still connect
who is asking for support?
they are?
you can code a simple plugin that increases the attack damage
There are literally hundreds of fire hardened plugins with years of bug fixing.
there is a lot of threads about that
Do u have any?
Plugins which work on a standard Spigot install.
thats not a plugin link :D
Anyways. If you really want to code with old buggy software:
You need to add the spigot API as a dependency to your project.
Do you use maven?
Then try running BuildTools with the 1.8.8 as target to install it into your local maven repo.
It makes no sense why people prefer 1.8 pvp, 1.17 pvp is perfectly fine if you know how to do it, but 1.8 pvpers dont so they stick to 1.8. IMO there is more of a skill gap with 1.17 pvp.
i like 1.8 pvp because its just better
How?
They just wanna click real fast.
its perspective
1.17 pvp has cooldowns so you cant do any of the cool stuff you could do before, like combos/strafe hit
yup
while i like 1.17 pvp, it lost all the cool parts and became a hit n run fest with axe crits and shields
theyre both good, in different ways
1.8 for fast paced skill heavy combat and 1.17 for slow paced tactile combat
I do myself not like shields, but what you can do is lower the damage for all weapons, remove shields and remove the hit cooldown. This edited version of 1.17 pvp is very fun.
no 1.8 is not skill heavy
that is exactly 1.8 pvp
its who can click faster
no its definitely not
it is you click faster you hit them first
i can click 10/s and lose to my friends that click like 6/s
its strafing, positioning, and combos
then you have bad aim, but bad aim will make you lose in both 1.17 and 1.8 so it doesn't really mastter
you want to get out of the way of their cursor, keep them in your cursor, and crit them while moving forward
if you drop them at any point you're getting hit back
anyways, I'm having an issue finding a file. Any reason why this is coming back with an exception?
File file = new File(player.getWorld().getWorldFolder(), "data" + File.separator + "minecraft" + File.separator + "loot_tables"
+ File.separator + "entities" + File.separator + "zombie" + ".json");```
This should be a file that exists.
data/minecraft/loot_tables/entities/zombie.json is the target file.
Don't know much but don't you only need 1 argument.
What do you mean, as in I'd only need zombie.json?
Try this
final File folder = new File(player.getWorld().getWorldFolder() + "data" + File.separator + "minecraft" + File.separator + "loot_tables"
+ File.separator + "entities");
final File zombieFile = new File(folder, "zombie.json");
And make sure the file is actually there.
iirc you don't need the file separators
File constructor has multiple overrides, of which includes File(String, String), directory and file name accordingly
/
you can just turn them into forward slashes and java should already convert
And yes, you're right. Forward slashes
just realized that getWorldFolder is going to, coincidentally, get the world folder and not the .jar. Back to drawing board.
Use 👏 java.nio 👏 for fuck's sake
yeah immutable strings
Since so many people are here, how do I get to the minecraft.jar? Haven't been able to find a way to call it using Spigot yet.
wdym
not a problem Java 9+ iirc bc StringConcatFactory but yeah
I want to call files that exist inside the minecraft.jar. Like data/minecraft/loot_tables/entities/zombie.json for example.
minecraft.jar hasn't existed in a long time (they changed how the version jars worked back in 1.5.2), and it's client-side only so you wouldn't be able to access it in any way from Spigot.
^
and you have no idea where it could be installed as it can vary anyway
and not all servers have clients installed
in fact most servers dont
lol
Just realized then, should I just make a datapack using the file function that has every default loot table in game, then I can access them whenever and it gets replaced from default?
that would get messy pretty quickly
besides, I believe datapacks are loaded on the server?
They are
your java version is 8
o
change it in project settings
is it the sdk version?
yeah
right there
java 16
got it
minecraft 1.17+ now requires java 16
in that case, the server has access to datapacks.
I'm unsure if it's possible to programmatically modify a loaded datapack (my knowledge of the API is limited) but there's better ways than rewriting all of the default datapacks lmao @atomic gyro
Yeah this has gotten a bit confusing.
whats the best way?
for (account a : accounts) {
if (a.name() != name) continue;
}
return a;
or
for (account a : accounts) {
if (a.name() == name) return a;
}
the second
2
I'm more or less just trying to get the data inside a loot table as a string so I can use it, but considering I'd need to either recreate it in a datapack or find a way into a file I can't access, I'm gonna have to go back to the drawing board.
the first would loop through the entirety of the list
i'm wondering why people actually use it then
oh and also
the first is just plain invalid semantically
as a doesn't exist outside of the scope of the for loop
its just an example
aaaand you should probably use .equals when comparing strings and objects in-general
iknow 🥺
but the example literally wouldn't compile, how could I possibly recommend the first option? :p
Should i use plugman to reload only my plugin not the server?
never
something else then?
I used a plugin kinda like it once
forgot what it was called tho
it worked pretty well
restart the server
i have like 3 plugins, its a private server i dont think restarting is rlly needed
cant i return something in a lambda expression?
it depends on the signature of the expression
if it's a Function then it has the ability to return
(or if it's a Supplier)
Then deal with all the errors reloading causes lol
but something like Consumer can't
in this context
Just beware that sometimes stuff works with reloads but borks on restarts
ah its a consumer
yeah, forEach is a Consumer<T>
you can't use a lambda here
bc you can't get the account out of the lambda scope due to effectively-final/final rules
you can never return a method inside a lambda
i have a decent plugin manager its fine
A lambda is effectively an anonymous class
not just effectively, pretty sure it's also internally an anonymous class
but I'm unsure, it generates the InnerClasses attribute on a class with a lambda so I assume so.
I'm curious as to see why it generates InnerClasses then, lemme look at the JVMS
well, a class is created at runtime. but that is not visible in the bytecode
hmmmm seems it's hard to find information on lambdas from the JVMS
oh lmao
that is comedic
so yeah
a lambda is only effectively an anonymous class, u right
How would I replace a specific entity with my own custom one?
quick question, does the index of getWorld from getServer go 0: overworld, 1: nether, and 2: end?
remove the entity from the game and spawn your custom one at the same location
Would I use entity spawn event?
Like it would check for that specific entity using instance of that specific entity, then it removes it
Then it spawns in mine right
Problem is my class extends that specific entity and instanceof includes subclasses so should I make an object of that specific entity and check for whether the event.getEntity equals that specific entity?
obj.getClass() exists
Anyone know how many decimal places a Java program double will solve before rounding
Pls ping me if you respond
Worlds.get(0, 1, and 2) would return the Overworld, Nether, and End respectively right?
yes
probably
depends on what is enabled in what order, but 0 is always overworld
You'll never have a guarantee of that
Even world_the_end and world_nether aren't guaranteed
Lets just say no guarantees, but I've never seen an occurrence where 0 wasn't overworld, even after many reloads
Bois why do my plugin.yml say that permission.yml is empty?
I'm pretty sure it doesn't say that
I mean it says permissions.yml is empty ignoring it.
That's a message from Bukkit. You can ignore that lol
Why doesn't my plugin work then?
Can you please tell me what there should be in the commands: ?
If your plugin isn't starting it's for some other reason. Let's see your full server log
?paste
I'll send you.
whats the best way of making a yaml file? putting a default one in the jar or creating one yourself on enable?
If you want comments, put one in the jar
Depends on the situation but generally speaking it's much easier to just have a regular file you can copy
Having to write it out in a more verbose manor just doesn't make sense ;p
oki
new HashMap<>(theOtherMap);
yo what's the point of the bitmask @ #getAsInt()
LargeFireball fireballprojectile = player.launchProjectile(LargeFireball.class);
fireballprojectile.setVelocity(fireballprojectile.getVelocity().multiply(1.5));
fireballprojectile.setIsIncendiary(false);
fireballprojectile.setFireTicks(0);
fireballprojectile.setShooter(player);
How can i make this break blocks?
You can use World#getEntities(Dolphin.class) or something like that
Why are you trying to iterate through a HashMap?
Can I see the error?
Is there a way to cancel a player right clicking? So say I want him to be able to right click once and not hold it, so he has to continuously click?
<ItemStack>
:/
you need to use keySet() or values()
or add all the items you want to remove and remove them after
or use an iterator, then you can remove
Anyone know if Damageable#damage(dmg, source) calls EntityDamageByEntityEvent?
an Iterator is teh correct approach.
Depends on the source most likely
Consider naming your variables descriptively
What do you mean?
yes, but its not a good idea
Wouldn't that effectively clone every time
What is getBingoItems returning
Bruh
Why are you creating a new one
Why
?
You just need to handle your data safely
Just don't use an enhanced for loop?
And it won't even prevent CME
with an iterator you can safely remove elements without cloning anything
Use a regular for loop and just do list.remove(i); i--;
Iterator is also a good solution
removeIf is also cute
If you're not doing anything but removing specific elements (or if you are removing multiple) use removeIf
Beat me to it
tbf yours has more info xD
ugh can i put an message with a ' in a yml string?