#help-development
1 messages · Page 2170 of 1
You should ignore the performance aspects of getClaim for the meantime, it is rather easy to refractor it later on
(Especially given that ABI is likely to stay preserved in that case)
Allright
public class ClaimListener implements Listener {
@EventHandler
public void onBreak(BlockBreakEvent event) {
Player player = event.getPlayer();
Block block = event.getBlock();
Claim claim = this.plugin.getClaims().getClaim(block.getLocation());
if (claim == null) return;
if (claim.getOwner().equals(player.getUniqueId())) return;
player.sendMessage("§cYou cannot build on §f" + claim.getUuid() + " §c claim");
event.setCancelled(true);
}
}```
Up to there all okay no problems, the problems come when i need to add more checks
You can just add the checks in your claim class if you want
Claim class is an object
Which is mean only to keep data of each claim (getters in fact)
So something like
Claim claim = xyz();
if (claim != null && !claim.canBreak(player) {
player.sendMessage("§cYou cannot build on §f" + claim.getUuid() /* Why UUID ???? */ + " §c claim");
event.setCancelled(true);
}
i thought that this.getConfig().options().copyDefaults(true) replaces values that are not set in the config with config values from the file within the jar?
no it does not
You can add other methods however
Hmn
or is it just loading absent values in memory?
?jd-s -.-
It basically copies all values from the "default" configuration (which you set via above method) into the configuration you called the method on
i just want to return the default translations from within the jar's file when stuff isnt set in the actual language file
Then you specify the config file within the jar as the default config
arent they doing the same?
Wha?
by setting copydefaults wont it get defaults from the jar's file?
Do you think bukkit randomly chooses some random resource within your jar so that resource can be the default config?
Of course it does not
Creating a random dice roller generate a random number
What is the recommended alternative to Bukkit.getOfflinePlayer(String name)?
Use case: get offline player from string in a command
item.setType(Material.FLOWER_BANNER_PATTERN);
meta.setDisplayName(ChatColor.RESET + "Pattern");
List<String> loreList = new ArrayList<>();
if(pattern == null){
loreList.add(ChatColor.GRAY + "current Patter = none");
}else {
loreList.add(ChatColor.GRAY + "current Patter = " + pattern);
}
meta.setLore(loreList);
item.setItemMeta(meta);
inventory.setItem(10 , item);
hello! Im trying to make a system where a player can make there own banner. Im using the banner pattern as itemstack but minecraft already put lore on it. how do i remove this?
item.getItemMeta().getLore() doesnt work
by alternative do you mean one thats not deprecated?
Depends on what you're trying to do exactly ?
like this i guess
getOfflinePlayer is deprecated because names are no longer unique past a single session thus it may end up having to make a web request to mojang to get the current uuid of a player by their name
i've been looking but i didnt find any code that does a web request to mojangs servers
So I currently have a janky method fetchUUID that makes a request to https://api.mojang.com/users/profiles/minecraft/<username> and uses Gson to get the player ID. But I'd prefer to not write my own APIs for that if there's a built in. And I know that getOfflinePlayer is just doing this under the hood
just run it in a thread is the only real thing you can do as far as I know
just so it doesnt take over the main thread, but last I checked that was a few updates ago not sure if it still does the same read below
Oh yeah they switched it so you instead get an inaccurate uuid or sth perhaps
damn really
This method may not return objects for offline players
Does it always return a player if they've played before?
For my application though, I use a redis server that stores the players name and UUID, allowing me to query that to get a name from a uuid or vise versa, and just update on a player connection.
And if they’re online
Only online? Will it always be null for offline players?
Yes
My use case is specifically getting offline players who have played before
then getOfflinePlayer(String name) should be fine?
a Player object requires the actual player to be online, so getPlayer would require the user to be online
Any chance this method is getting removed in a future release?
never
I doubt it will be removed
md likes backwards compatibility, its also in no way marked for removal
items don’t just come with lore on it, it’s probably the client side text that you can remove by adding ItemFlag.HIDE_ATTRIBUTES
thanks!
where do i add that?
on what line
meta.addItemFlags
ty!
it doesnt work
the text is still there
what is the text?
the client side text
i’m not sure if you can remove the pattern text on a banner then
D:
I GOT IT!
its hide dye
neat
no it isnt
bruh
my code rn lol :
tem.setType(Material.FLOWER_BANNER_PATTERN);
meta.setDisplayName(ChatColor.RESET + "Pattern");
meta.addItemFlags(ItemFlag.HIDE_ATTRIBUTES);
meta.addItemFlags(ItemFlag.HIDE_UNBREAKABLE);
meta.addItemFlags(ItemFlag.HIDE_DYE);
meta.addItemFlags(ItemFlag.HIDE_DESTROYS);
meta.addItemFlags(ItemFlag.HIDE_ENCHANTS);
meta.addItemFlags(ItemFlag.HIDE_POTION_EFFECTS);
List<String> loreList = new ArrayList<>();
I'm trying to build my plugin with Java 18 & Spigot 1.18 and I get this error
Unsupported class file major version 62
Anyone know how to fix? Internet isn't helping much, and I've really only made 1.8 plugins with Java 8 before this
My friend, meta.additemFlags(ItemFlag.values())
;p
I’d guess and say that your code somehow adds back the already checked blocks
Meant the list
But yeah debug it using a debugger would probably be the best way to find the culprit
Your getConnectedblocks(Block block, Set<Block> results, List<Block> todo) also adds the origin block into the todo list as you fetch all 6 BlockFaces
Hey please send a the email symbol
@kind patrol ^
My keyboard its not writting it idk why]
like @?
yeayh
I dont know why i cannot write it
Im pressing AltGr + 2
you have to keep a Set of all processed blocks
don;t add any which you have already tested
its just a couple of methods, but it can be confusing recursively checking
you just need two methods, one is a simple one. Pass it a Block and it returns a list of all Block in the cardinal directions.#
then in your main method java Set<Block> tested = new HashSet<Block>(); List<Block> toTest = new ArrayList<Block>();
so you call this method passing yoru origin Block
toTest.add(origin);
while (!toTest.isEmpty()) {
Block test = toTest.get(0);
toTest.remove(0);
tested.add(test);
for (Block block : getCardinalBlocks(test)) {
if (!toTest.contains(block) && !tested.contains(block)) {
toTest.add(block);
}
}
return tested;```Probably something close.
if(data.get(new NamespacedKey(GioxMC.getPlugin(), "magnet"), PersistentDataType.INTEGER) == 0) return;
When I try to compare it to 0, it doesn't work, any ideas why ?
Conclure does Lettuce support objects?
oh no, am I too old to know that it's called an ampersand?
I'd have even accepted "at", but "email symbol"!?!?
um, ampersand is &
Well everything in redis is sent as strings
FUCK
😄
Lol
But no one have already do something for objects?
I know it as at
"email symbol" is still weird though 
it is
I have no num pad so I can;t test
he?
Doesnt your keyboard have numbers?
Mines doesnt have num pad but it has numbers 🤔
yes just no numpad so can;t use teh ALT numpad to get wierd characters
ByteArray can be serialized a strings?
eg ALT+064 is @
what its 064?
oh my, thats what I was saying
it didnt work
Yes, it only works with a numpad. I don;t have one.Neither do you
i have
If you have, hold down ALT, then press 064, then let go of ALT
but hold all them at the same time?
An @ will appear in whatever text entry box you have active
?paste
how could i get item name? getDisplayName doesn't work.
recursion might be better for this
b1 has to not be in toTest and not in tested
Your code will also not include the origin block
no, you are adding all those around it
oh you are already adding it to tested
but b1 has to not be in either
if its already been tested we need to ignore it, and if its already in toTest we also need to ignore it
Im using a Bukkit Runnable to make a countdown from 6 to 0. However it goes 5, 3, 1 for some reason and then it wont stop when it gets to 0 and it'll keep counting down. Here is the runnable:
final int[] startTimer = {6};
joinedPlayers.forEach((String playerName) -> {
Player p = Bukkit.getPlayerExact(playerName);
new BukkitRunnable() {
@Override
public void run() {
startTimer[0] = startTimer[0] - 1;
p.sendMessage(prefix + ChatColor.WHITE + "Game starts in: " + startTimer[0]);
if(startTimer[0] == 0) {
this.cancel();
}
}
}.runTaskTimer(main, 0, 20);
p.sendMessage(prefix + "RUN!");
You are using a global startTimer but running a forloop over each player. You are reducing it for each player, not once for all
ahh
so how do i make it send a message to each player in the array with the same number
move the order of the runnable and foreach
you put the forEach inside the runnable
other than that I see nothign wrong in yoru code
that would be ServerPlayerGameMode
https://nms.screamingsandals.org/1.18.2 might be useful for you in the future
@flat leaf
how could i create enchant form string?
it costs money ;-;
"it's open source"
any blocks around the toCheck Block are added to the toCheck Set so they will be processed when it loops around
Do you mean like if you want sharpness, it would translate to Enchantment.DAMAGE_ALL?
should learn what open source means
I seem to have an issue where the bukkit scheduler isn't working in a linux environment
works in a different linux environment
actually im mistaken
seems to not work at all!
currently gona investigate
a couple premium plugins have license systems, which iirc is against spigot terms
most migrated to mc market i think though
And what does this have to do with anything?
nothing lmao
just saying you cant just compile opensource sometimes
since they require data from a server
?paste both methods, so I can easily read them
a CCM
Open source. You just remove the verification
its not that simple all the time though
If you notice mine, I don;t loop the toTest
I only loop the blocks returned by the getCardinal
Haven't had a single case where it wasn't that simple
because you can;t modify a List you are iterating
But I guess there might be some odd project out there
I downloaded this and idk how to compile this to jar
please help
why was the /gamemode 0|1 command changed to /gamemode survival|creative
kinda annoying
ok so i've made a firework object how do i make it explode to cause the effect, here is the code for the firework:
Firework fw = (Firework) deathLoc.getWorld().spawnEntity(deathLoc, EntityType.FIREWORK);
FireworkMeta fwm = fw.getFireworkMeta();
fwm.setPower(2);
fwm.addEffect(FireworkEffect.builder().withColor(Color.LIME).flicker(true).build());
fw.setFireworkMeta(fwm);
fw.detonate();```
I opened this and it just opened that:
It's a command you run in the terminal
Not the file
how do i open the terminal
that doesn't make it explode i dont think
hm that wouldn't even detonate because it doesn't have fw.detonate();
idk about that it's old code from 1.12 I think
thats just not helpful
Well
@harsh totem are you familiar with maven?
Cuz it’s pretty similar to how maven works
im not
Okay
There should be a tab there (hint the red arrow)
Click it and a window should expand
I have this
Yes expand shadow
any one can help how would I store Object to mysql
And run shadowJar
Is there a way to cancel the creation of a fire at the location a lightning strikes?
any good example for it
I want to turn HashMap to Object and store it to mysql
so I can next time read it and loaded it
You would need to serialize that Object
when server starts up
and what data type should I do for that colume in table
Lots of Build folders were created but none contain the plugin jar file
Try the task build instead perhaps
Is always while loop kills the server?
press build?
It can if it takes too long time to execute limpeex
it can crash
Although I wouldn’t worry too much unless you do some recursion for instance
how can i control something inside of the runnable
wdym?
its ur code, just do it
Yeah ytg altho have you checked all the orange build folders?
https://www.spigotmc.org/wiki/connecting-to-databases-mysql/
This should cover everything you need
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
Pretty sure the jar should be located in one of those
if u run the build task in gradle it should be in build/libs
i mean i want runnable to run in a condition, otherwise cancelling
shaded jar and regular iirc
Correct
I dont have any experiences with threading
i dont know if it returns the beginning
Bukkit.getScheduler().scheduleSyncDelayedTask(plugin, () -> {
if(...) {
//do stuff
}
}, 20L);```
or wdym?
multithreading ezpz just have an atomic boolean that u check in the threads while loop and on ur main thread set that boolean to false when program is exiting
😎
?scheduling
That's all the jar files that were created
Hmm try the second one
that was the first one i tried
Didn’t work?
You need Eco. Also don't reload
^
wdym by "you need eco"
It’s a library
for the server or the project
yes
God I need to rewrite that wiki page again 
Ow
who here is good at sql and relational databases
Any ideas as to why this is returning as null?
if(data.get(new NamespacedKey(GioxMC.getPlugin(), "magnet"), PersistentDataType.INTEGER) == 0) return;```
When I try to do ```java
data.get(new NamespacedKey(GioxMC.getPlugin(), "magnet"), PersistentDataType.INTEGER)```
it returns the pdc value of it, which is 0 but when I try to compare it, it nulls.
[00:15:40] [Craft Scheduler Thread - 5/WARN]: [TabList] Plugin TabList v5.6.2 generated an exception while executing task 30 java.lang.NullPointerException: Cannot invoke "me.clip.placeholderapi.PlaceholderAPIPlugin.getLocalExpansionManager()" because the return value of "me.clip.placeholderapi.PlaceholderAPIPlugin.getInstance()" is null at me.clip.placeholderapi.PlaceholderAPI.setPlaceholders(PlaceholderAPI.java:71) ~[?:?] at me.clip.placeholderapi.PlaceholderAPI.setPlaceholders(PlaceholderAPI.java:98) ~[?:?] at hu.montlikadani.tablist.utils.variables.Variables.setPlayerPlaceholders(Variables.java:241) ~[?:?] at hu.montlikadani.tablist.utils.variables.Variables.replaceVariables(Variables.java:178) ~[?:?] at hu.montlikadani.tablist.tablist.TabHandler.sendTab(TabHandler.java:256) ~[?:?] at hu.montlikadani.tablist.tablist.TabManager.lambda$addPlayer$0(TabManager.java:54) ~[?:?] at org.bukkit.craftbukkit.v1_18_R1.scheduler.CraftTask.run(CraftTask.java:82) ~[spigot-1.18.1-R0.1-SNAPSHOT.jar:3443-Spigot-699290c-2c1e499] at org.bukkit.craftbukkit.v1_18_R1.scheduler.CraftAsyncTask.run(CraftAsyncTask.java:54) [spigot-1.18.1-R0.1-SNAPSHOT.jar:3443-Spigot-699290c-2c1e499] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136) [?:?] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635) [?:?] at java.lang.Thread.run(Thread.java:833) [?:?]
Why i get this error in some plugins
Version: 1.18.1
You get a reference to PlaceholderAPI too early
how are you setting it
I don't understand is there a solution?
are you a Plugin dev or an end user?
plugin dev but i will install plugins like scoreboard or tab when i install this plugin i get this error
Then contact the dev of that plugin and tell him he's grabbing an instance of placeholderapi too early in his startup
This is impossible. The problem is in more than one plugins. I downloaded a lot and the same problem
data.set(new NamespacedKey(GioxMC.getPlugin(), "magnet"), PersistentDataType.INTEGER, 0);
Do you have placeholderapi on your server?
yes
well seems like your data is not properly persisted
Problem is solved, you have to use .equals(STRING) inside of it, even tho it clearly returns a INTEGER
wat
Since you set the value type to an int.
if(data.get(new NamespacedKey(GioxMC.getPlugin(), "magnet"), PersistentDataType.INTEGER).equals("0")) return;
I can only comment on the error you posted. The plugin is getting a null reference to placeholderapi. That can only happen if placeholderapi failed to load or you ask for the instance too early
Ok thanks man I will try to solve the problem (:
which minecraft items look the most like a gun
retexture
without retexturing
What do you guys think would be the best sound effect to play when a player looses hunger?
mjanko i used to see people use iron horse armor
that represents like a growling stomach
How do I play those?
world.playSound(as, Sound.BLOCK_NOTE_BLOCK_BASS, (float) 0.8, 1);
the float is the volume
replace as with your player
minecraft:block.cave_vines.pick_berries
that's a good one mjanko
thanks < 3
Hey, before blindly unloading and deleting a world folder, what are some necessary things I should do?
idk you should be good to just delete it given you gave no information on any problems
it'll just create a new one on start up
Hi, since few days now, we are facing some troubles. It seems that it happends when we try to go in another world just after load/unload a world Link/paste of stack trace https://pastebin.com/GvMTe...
That is what I have been doing but it keeps throwing these errors
i have a database with a table of things and i want to keep track of what things a player has visited, how do i do this with database
i want to be able to get the list of things a player has visited
depends what those things are
Do I get an error if I remove 2 from a player's food level, but he has only 1 left?
Or does it just set it to 0
you probably need to use a primary key pair. Players uuid and the ThingID
then the player can have multiple records but only one for each ID
Block is the corner of the block
0,0
is this the best way, what about using an array
To get on top of the block, in its center Block#getLocation().add(0.5, 1, 0,5);
What is better way for armorstand nametags? via packets or not?
You could use arrays
how do i do that
players UUID and an array of ThingID
then how would i select * from Things where ThingID = the ones in the array
SELECT * FROM Things WHERE ThingID IN ?
mayb
i made up that syntax
You select the players record and read the ThingID array in the resultSet
you need to know WHO has visited what things
no i need to know what things a person has visited
Thats what I just said
u said a different thing
So each player has a record in teh database, it holds the ID's of all the Things he has visited
yeth
So two tables
and then what's the sql statement to get the Things that a player has visited from the Things table
one for (UUID, ThingsID[])
one for (ThingsID, any data on the thing)
Select ThingsID from table where UUID = playersUUID
gets you the array
I know, it needs to
you need a table to reference what Things a Player has viisted
There are two things your database needs to contain....
a list of Things and a list of players showing what Things they have visited
you are instance checking with == These are Locations you are comparing so use .equals
Is there a way to spawn those "snow particles" ?
How can I get player body rot?
how does this select the things from the Things table
the Things don't have a playerUUID
if you want teh Things from the things table you use the join in sql
I've never used join when using arrays so I can;t advise you on that
Ok I give up. you are not listening
me?
You want to know what Things a player has visited. This data is to come from your database. So your database must contain TWO things at a minimum. Some way to identify the players (their UUID) and the Things they have visited.
yes, there are two tables in the database: a list of Things each containing a ThingID, and a table containing Players, each row containing an array of ThingIDs
ok, so you query the Players table to get their array of ThingIDs
yes
the yaw is the head rot, I need the body rot
Select ThingID from Players where UUID = player.UUID
that gives you the array of ThingIDs
yes
welp NMS it is
You then want to know what Things those ThingIDs relate too in teh Things table
yes
Normally you would use the join to tell the SQL query what column to look up the values in the Things table but I've never used an array for that
im attempting to teleport two players into a world when they join the server, imt eleporting the players i make one of the accounts join and wait 10s later to let the other one join and the first player cannot see the second player while the second player can see the first player.
anyone know how to fix this?
can you do like SELECT thingID1, thingID2, thingID3 FROM Things?
you could
if you do it all as one query, no
yes i build the statement string then query in one go
as I said normally you would join to make teh query simple, but I've no idea how you would do that from an array
yes
how would join work if we weren't using arrays
if its possible to use an array to join
select ThingID from Players where UUID = player.UUID inner join Things on ThingID = Things.id
or somethign of that type
Hello everyone. Please tell me how can I push the player in the direction of movement?
setVelocity with a multiple of getDirection
anyone?
player.hidePlayer(otherPlayer)
When should I call it?
use join event and just hide the player who joined to everyone who's online for 10 seconds
His issue is only one player can see the other at the moment.
Without hiding
the issue is that when the second player joins he can't see the first player but the first player can see the second one
there isn't any coding hiding it since it's only running my custom plugin
Wait
You want to hide the player who joins for 10 seconds to just one specific other player?
I have a vague recollection of a visibility issue like this, but it was way back in 1.7
No, he wants both players to be able to see eachother
im running 1.8.8 iirc
im actually not sure what im running let me check
I guess its possible that bug still existed in 1.8.8
how did you fix it?
I didn't it would have been an MC/Spigot issue
Ah you mean that's an issue on your server that the one player can't see the other one?
Is there a way to change smoke particle color?
Can someone help me with a toggle gui i'm trying to sort, the toggle is currently working.
Its disabled by default, when enabled it will ban if you, if you die. But when dying and then reconnecting (after unbanning) the toggle is reset back to false?
while when I disconnect and reconnect normally this is not the case?
I stopped coding for Bukkit at 1.7 and didn't return until 1.14 ish. So the bug was fixed while I was gone.
Ive ran 1.8.8 for a long time (until recently) and never experienced any issue like that
I remember it happening on laggy server in 1.7
is there any fancy way to register all my listeners without having to type them all out?
iirc Redempt has a method for it in their library
im going to redeploy my docker image with a new spigot jar and see if it fixes the issue
reflections
How would I use this?
Check out https://github.com/Redempt/RedLib/blob/master/src/redempt/redlib/RedLib.java they have a method to get all classes that extend a class
That should work for your idea
^ would use this instead of adding a whole new depend for it
I already use redlib in my plugin 😄 thanks
Lol that works then
Casting doesnt work,
go ask in redempts server
^
oops mb
i dmed you the link
By smoke do you mean those smoke particles that come from the fireplace? Pretty sure you can't change those.
Yes I mean Effect.SMOKE
Is there a way to cancel the creation of fire when a lightning strikes the ground?
I'm building a plugin for my server and want to add an evasion system. How can I make the player push in the direction of travel? not necessarily forward. For example, the player will slant straight ahead, and go obliquely to the right. In this case, the player should be thrown obliquely to the right. And so on. I hope I explained clearly.
So the player would dodge in the direction of their movement, but not where they are looking
Yes
Didn't quite write it right. You're right. But the question is the same. How can i do this?
if you want to throw them to the left or right, Player#getLocation().getDirection() gives you the vector in which they are traveling. Vectors have a set of rotate methods. Rotate the vector, then apply it to the players velocity
Won't getLocation().getDirection() return where the player is facing rather than where they are moving?
only if you use getEyeLocation()
I understood that, but when should I change the vector? How can I understand that the player is moving in the right direction?
When you want them to "dodge" is up to you
after all, what is the "right direction"?
Oh right, I got it. I recently started creating plugins, so I don't understand everything. Could you write it in code if you don't mind?
Hello, I'm looking to import craftbukkit with maven in 1.18.2 for an hour. I can't find the maven dependency. Could someone help me? Thanks in advance ^^ !
I'm talking about this
Really depends on when you want them to do the dodge.
If you meant spigot, https://www.spigotmc.org/wiki/spigot-maven/
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
When to perform evasion I have already done. Now i need to understand how should i change movement with getDirection and its rotation
Spigot is already in my dependencies but I need craftbukkit to access some particular classes but I can't import it...
I tried this but it doesn't work
<dependency>
<groupId>org.bukkit</groupId>
<artifactId>craftbukkit</artifactId>
<version>1.18.2-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
If you need access to the CraftBukkit classes you need to run BuildTools, then depend on spigot and not spigot-api
<groupId>org.spigotmc</groupId>
<artifactId>spigot</artifactId>
<version>1.18.2-R0.1-SNAPSHOT</version>
<scope>provided</scope>```
?bt
Okay so if I add the spigot jar with maven, no need for CraftBukkit as a dependency?
correct
BUT you have to run BuildTools as CraftBukkit is the implementation not API
Okay, I'll try it out, thanks!
You would multiply the direction by the amount that you want to launch the player with. Then set the player's velocity with that. Like
Vector dashVector = player.getLocation().getDirection().multiply(2);
player.setVelocity(dashVector);
if you use getVelocity() over getDirection, it will be better
I was just looking it up
I just added the jar to my project but the dependency doesn't work (Unresolved dependency: 'org.spigotmc:spigot:jar:1.18.2-R0.1-SNAPSHOT')
Did you run Buildtools?
Yes
for 1.18.2?
Yes
?paste teh buildtools.log
After building spigot 1.18.2, in the "project structure" panel of intellij I added the jar as a library. Is that what I needed to do?
Yes
you don;t add jars
and you don;t build spigot in inteliJ
remove the manually added jar
Okay
let maven find the dependencies from yoru local maven cache
Dosen't work 😅
Not tested but try this```java
public void dodge (Player player) {
Vector velocity = player.getVelocity();
boolean direction = ThreadLocalRandom.current().nextBoolean();
velocity.rotateAroundY(Math.toRadians(direction? 90 : -90));
player.setVelocity(velocity);
}```
Unresolved dependency: 'org.spigotmc:spigot:jar:1.18.2-R0.1-SNAPSHOT'
it will only throw the player a short distance. You can multiply the velocity after to achieve what you want
click the refresh button in yrou maven panel in InteliJ
It didn't change anything, the same error...
show me your buildtools log
Can I send it to you in mp?
?paste
it should fit
(I tried to copy it to the site but it doesn't work, it's too big 😭)
The chrome tab is no longer responding 😭
lmao
paste teh last 50 or so lines then
Ok
Thanks
Thanks
for (HumanEntity p : event.getClickedInventory().getViewers()) p.closeInventory();
this is line 44 in this stack trace:
[01:51:49 ERROR]: Could not pass event InventoryClickEvent to Waystones v1.0-SNAPSHOT
java.util.ConcurrentModificationException: null
at java.util.ArrayList$Itr.checkForComodification(ArrayList.java:1013) ~[?:?]
at java.util.ArrayList$Itr.next(ArrayList.java:967) ~[?:?]
at website.callens.waystones.WaystoneGUIclickEvent.onClickGUI(WaystoneGUIclickEvent.java:44) ~[waystones-1.0-SNAPSHOT.jar:?]
at com.destroystokyo.paper.event.executor.asm.generated.GeneratedEventExecutor3.execute(Unknown Source) ~[?:?]
im just trying to close an inventory for anyone looking at it
I'm going to go crazy I have a haunted file 😭 it won't copy and paste 😭 😭
you are iterating over the viewers and removing them at the same time
:v fundamental programming error
If you want to go through them and remove them, you could either iterate from the end of the list and go to 0, or you could use an iterator and use the .remove() method. Wait this may not work
How would I cancel a player to remove his helmet?
it installed to your repo fine
clear caches and restart Intelij
Hello friends, This error confuses me as I get the Player's uuid and then try to convert it from a string to a uuid object, ```java.lang.IllegalArgumentException: Invalid UUID string: d2698c41e5fb4dc98e887f8d524c9545
at java.util.UUID.fromString1(UUID.java:280) ~[?:?]
at java.util.UUID.fromString(UUID.java:258) ~[?:?]```
👍
The dashes are missing
how can i find the keys which map to a specific value in a map
I see that, I the uuid is gotten from the Mojang Api, is there a way to work around this?
Think there are dashes every 8? Characters
int viewers = inv.getViewers().size();
for(int i = viewers-1; i >= 0; i--)
{
inv.getViewers().get(i).closeInventory();
}
a hacky solution, thanks
Iterator<HumanEntity> iter = player.getInventory().getViewers().iterator();
while (iter.hasNext()) {
iter.next().closeInventory();
}```
@maiden vapor how do i do this
I'm wrong
Arg! It still doesn't work 😭
its 8, 4, 4, 4, 8
The same error
Yeah
did you actually clear caches and restart, or just restart?
8, 4, 4, 4, 12*
I made "Invalidate Caches and restart"
Okay
how do i get all keys which map to a value in a map
use a BiMap
Iterate over all of them and check if they have the value you want?
Usually I find when people have that issue they need to reverse their map
how do bimaps work
both sides are unique keys
ah true, so no good for his purposes
I'm really sorry I had to take a screenshot my copy and paste doesn't work anymore and I don't know why
https://i.imgur.com/w3KVrAH.png
all is fine, except for yoru java version
its in your .m2 so it shoudl be picked up. fix your java version as it requires at least java 17 for 1.18 I bleieve
my .m2 ?
not the best implementation but ```java
UUID = insertString(UUID, "-", 8);
UUID = insertString(UUID, "-", 13);
UUID = insertString(UUID, "-", 18);
UUID = insertString(UUID, "-", 23);
return UUID;
// https://www.geeksforgeeks.org/insert-a-string-into-another-string-in-java/
public static String insertString(String originalString, String stringToBeInserted, int index) {
String newString = new String();
for (int i = 0; i < originalString.length(); i++) {
newString += originalString.charAt(i);
if (i == index) {
newString += stringToBeInserted;
}
}
return newString;
}```
thats your local maven repository
java.util.UUID.fromString( "5231b533ba17478798a3f2df37de2aD7" .replaceFirst( "(\p{XDigit}{8})(\p{XDigit}{4})(\p{XDigit}{4})(\p{XDigit}{4})(\p{XDigit}+)", "$1-$2-$3-$4-$5" ) ).toString()
Lol
Okay, you know how to fix the problem? By going to this file?
Ok
and you ran Buildtools so spigot 1.18.2 is in there too
just your InteliJ says it can;t see it
no
Okay
In fact the only thing I see wrong in yoru setup now is your java version
Okay
It shoudl be showing up
But it's not possible, where can it come from 😭 ?
does .clone() on an ItemStack also clone Enchantments, etc?
isn;t there a refresh button in teh maven tab of InteliJ?
I don;t use InteliJ so don;t know my way around it
Pretty sure it clones everything of the item
Yes, but it gives me the error every time I click on it
That's what I was hoping
i just tried creating then deleting a bunch of stuff from my h2 database but it just made the database bigger
I just ran a test here. Did just as you. works fine for me
Oh, ok....
Is it "player will fall from the sky" or "player is going to fall from the sky" ?
depends on the context, but both are grammatically correct
context is that a player executes a command which let's the target fall from the sky and then the executer gets the message
I'd probably use the first then
yes
man I envy you
xD
Is it "recognize" or "recognise" ?
My teacher always said he doesn't care, just take one of them haha
I was wondering if there was a better way to do the following code in order to return a text component as a string?
@Override
protected String[] get(Event event, Advancement[] source) {
List<String> titles = new ArrayList<>();
for(Advancement advancement : source)
titles.add(advancement.getTitle().getText());
return titles.toArray(new String[0]);
}
S for UK English. Z for American
ahhh okay
wait what
Sorry reverse
idk about the accuracy of this lol
most things are S for UK. Z for US. I've been in here too long
oh i was like idk if I've ever used an S for regonize
fixed 🙂
You could just use a Dictionary site. It will actually tell you the US and UK spelling
How good is that teh Cambridge Dictionary, a UK bases group defaults to the US spelling 😦
that's a great question!
Why thank you :)
hahah uff
bruh
any reason why we're talking about the dictionary?
I'd drop the ArrayList and use an array
Cause I don't wanna use a wrong spelling in my plugins probably haha
Just grammatical decisions in text for plugins
Thank you, will do.
Hey I wanted to see if I can get some help..
Item 1
{PublicBukkitValues:{"loot:_loot":80L},SkullOwner:{Id:[I;-2026970914,-1921432084,-1200622279,1699038057],Properties:{textures:[{Value:"eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvYzA4ZTI3NzY4NDJiZGZkNmZhM2JhN2Q2NTRmNmZkNmFiMWFjZDg3ODQ3NTNkZmUyZThjNDk5YmNmZDFlZWQifX19"}]}},display:{Lore:['{"text":""}','{"extra":[{"bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false,"color":"gray","text":"Drop Info:"}],"text":""}','{"extra":[{"bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false,"color":"gray","text":"? "},{"italic":false,"color":"white","text":"Sells for "},{"italic":false,"color":"aqua","text":"$80"}],"text":""}'],Name:'{"extra":[{"bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false,"color":"white","text":"Ant-Man Loot"}],"text":""}'}}
Item 2
{PublicBukkitValues:{"loot:_loot":80L},SkullOwner:{Id:[I;-475614964,2137867341,-2074071497,-1007955428],Properties:{textures:[{Value:"eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvYzA4ZTI3NzY4NDJiZGZkNmZhM2JhN2Q2NTRmNmZkNmFiMWFjZDg3ODQ3NTNkZmUyZThjNDk5YmNmZDFlZWQifX19"}]}},display:{Lore:['{"text":""}','{"extra":[{"bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false,"color":"gray","text":"Drop Info:"}],"text":""}','{"extra":[{"bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false,"color":"gray","text":"? "},{"italic":false,"color":"white","text":"Sells for "},{"italic":false,"color":"aqua","text":"$80"}],"text":""}'],Name:'{"extra":[{"bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false,"color":"white","text":"Ant-Man Loot"}],"text":""}'}}
I'm spawning items from thin air with custom heads (like hypixel bedwars generators, but with custom heads), but the ID is different every single time
Item 1
{PublicBukkitValues:{"loot:_loot":80L},SkullOwner:{Id:[I;-2026970914,-1921432084,-1200622279,1699038057],Properties:{textures:[{Value:"eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvYzA4ZTI3NzY4NDJiZGZkNmZhM2JhN2Q2NTRmNmZkNmFiMWFjZDg3ODQ3NTNkZmUyZThjNDk5YmNmZDFlZWQifX19"}]}},display:{Lore:['{"text":""}','{"extra":[{"bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false,"color":"gray","text":"Drop Info:"}],"text":""}','{"extra":[{"bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false,"color":"gray","text":"? "},{"italic":false,"color":"white","text":"Sells for "},{"italic":false,"color":"aqua","text":"$80"}],"text":""}'],Name:'{"extra":[{"bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false,"color":"white","text":"Ant-Man Loot"}],"text":""}'}}
Item 2
{PublicBukkitValues:{"loot:_loot":80L},SkullOwner:{Id:[I;-475614964,2137867341,-2074071497,-1007955428],Properties:{textures:[{Value:"eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvYzA4ZTI3NzY4NDJiZGZkNmZhM2JhN2Q2NTRmNmZkNmFiMWFjZDg3ODQ3NTNkZmUyZThjNDk5YmNmZDFlZWQifX19"}]}},display:{Lore:['{"text":""}','{"extra":[{"bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false,"color":"gray","text":"Drop Info:"}],"text":""}','{"extra":[{"bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false,"color":"gray","text":"? "},{"italic":false,"color":"white","text":"Sells for "},{"italic":false,"color":"aqua","text":"$80"}],"text":""}'],Name:'{"extra":[{"bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false,"color":"white","text":"Ant-Man Loot"}],"text":""}'}}```
What code are you using?
Do you think it's because the Name is not there?
I have no idea, I guess i'm the wrong person to ask
How are you generating these Items?
Those two items are showing the same skin but different accounts
I'm going to guess they are being pulled from some website
My guess would be a base64 String to create the skull texture with random UUID generation could be why they aren't stacking properly
instead of generating a new skull every time just save one into memory and reuse it
yes they are base64 configurated with "CUSTOMHEAD:<base64 id>"
so putting a name would be useless right
I mean you could, but not a real reason to unless you want to
again I reccomend just saving it into memory and reusing it if you want them to stack
Is there a source I can learn this from?
Just trying to figure out how to do what you are saying
Is there a sound effect that sounds like a "whoosh" or like a wind blow?
not that I know of, but you could probably add your own sound effects with a texture pack if you'd be interested in that
Hm that's something I definitely wanna do at some later point, for now it's enough finding a sound that sounds somewhat similar
java.lang.NoClassDefFoundError: com/mongodb/client/MongoClients
at xyz.praydev.BorderSMP.registerDatabase(BorderSMP.java:99) ~[BorderSMP-1.0.jar:?]
at xyz.praydev.BorderSMP.onEnable(BorderSMP.java:67) ~[BorderSMP-1.0.jar:?]
at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:264) ~[paper-api-1.18.2-R0.1-SNAPSHOT.jar:?]
at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:370) ~[paper-api-1.18.2-R0.1-SNAPSHOT.jar:?]
at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:541) ~[paper-api-1.18.2-R0.1-SNAPSHOT.jar:?]
at org.bukkit.craftbukkit.v1_18_R2.CraftServer.enablePlugin(CraftServer.java:560) ~[paper-1.18.2.jar:git-Paper-349]
at org.bukkit.craftbukkit.v1_18_R2.CraftServer.enablePlugins(CraftServer.java:474) ~[paper-1.18.2.jar:git-Paper-349]
at net.minecraft.server.MinecraftServer.loadWorld0(MinecraftServer.java:664) ~[paper-1.18.2.jar:git-Paper-349]
at net.minecraft.server.MinecraftServer.loadLevel(MinecraftServer.java:431) ~[paper-1.18.2.jar:git-Paper-349]
at net.minecraft.server.dedicated.DedicatedServer.initServer(DedicatedServer.java:316) ~[paper-1.18.2.jar:git-Paper-349]
at net.minecraft.server.MinecraftServer.runServer(MinecraftServer.java:1163) ~[paper-1.18.2.jar:git-Paper-349]
at net.minecraft.server.MinecraftServer.lambda$spin$0(MinecraftServer.java:315) ~[paper-1.18.2.jar:git-Paper-349]
at java.lang.Thread.run(Thread.java:833) ~[?:?]
Caused by: java.lang.ClassNotFoundException: com.mongodb.client.MongoClients
at org.bukkit.plugin.java.PluginClassLoader.loadClass0(PluginClassLoader.java:151) ~[paper-api-1.18.2-R0.1-SNAPSHOT.jar:?]
at org.bukkit.plugin.java.PluginClassLoader.loadClass(PluginClassLoader.java:103) ~[paper-api-1.18.2-R0.1-SNAPSHOT.jar:?]
at java.lang.ClassLoader.loadClass(ClassLoader.java:520) ~[?:?]
... 13 more
Anyone know how to fix this on startup?
you gotta shade mongo
I did though
you sure about that mate
doesn't look very shaded to me 
Unless I broke it, I copied it from a de-compilation of an old project
why is it marked as provided
Not sure, thats what fixed it last time
This time not so much
I'll try shading again
?
your error
<dependency>
<groupId>org.mongodb</groupId>
<artifactId>mongodb-driver-sync</artifactId>
<version>4.5.1</version>
<scope>provided</scope>
</dependency>```
just delete the scope provided
it will then shade
Ah
by saying its provided maven basically is like aight you already got it bet my pal
and won't shade it
Alright cool thanks, I never really learned maven just how to get it up and running
When I compile, a shaded .jar doesn't appear?
its all in that jar
Interesting, in the past when I've shaded it makes 3 .jars and one of them is the shaded one.
^
Still getting the same error.
what should I use to run smth x amount of times with a delay of y after each run
thanks
nws
how do i play a sound for only one player
doesn't player.playSound() do that?
Im not sure
"Play a sound for a player at the location.
This function will fail silently if Location or Sound are null."
Play a sound for a player at the location of the entity.
"at the location" maybe others also hear it if near
is there any method to detect a player holding down left click, other then constantly placing a ball of ghost blocks around the player?
yea but then it only fires once
currently it is this as my variable:
GameProfile profile = new GameProfile(UUID.randomUUID(), "");
when he start clicking
i want to detect if he is currently clicking or not
/ if he is holding it down
Is there a pdc for blocks?
a what
how can I check for a status 404 in a json?
persistent data container
yea
in what context
The json returns a 404 it caches it
yes
json.getAsJsonObject().get("status").getAsJsonPrimitive().getAsInt() == 404
iirc chunks have PDCs but there are libraries like @tender shard 's for more stuff
Didn't seem to work
with a fancy name
well yeah but iirc blocks dont have an exposed pdc impl
like if i import spigot-api and try to get the pdc of a block there isnt a method p sure
If a plugin makes a request to a random site, can I use a separate plugin to cancel that request?
I was seeing that the AutoSaveWorld plugin can monitor the requests that a plugin makes to sites out there
[AutoSaveWorld] Plugin mcMMO attempted to establish connection https://site.com/endpoint in main server thread
new JsonParser().parse('{"status":404}').getAsJsonObject().get("stats").getAsInt()
i am trying to find out if there are any entities in a 1x2x1 (xyz) volume using this code if (!world.getNearbyEntities(relative_block.getLocation().clone().add(0.5, 1, 0.5), 1, 2, 1).isEmpty()) return; but isn't working right, it's checking some other area
Y2K are you active?
yes but I have to mention that my lib merely maps "locations" to PDCs
if a block gets moved by a piston etc, you have to take care of that yourself
Does anyone know why this still teleports me into the block and not on top of it?
Location oneUp = target.getLocation().clone().add(0, 10, 0);
Location ground = oneUp.subtract(0, 2, 0);
target.getWorld().getBlockAt(ground).setType(Material.BARRIER);
target.teleport(oneUp);```
ah you mean oneUp.clone().subtract... ?
yes
I try
Is there a command to remove all blocks with a specific material in the world?
Cause I used barriers which turn invisible after some time..
plz i can't figure it out
this worked btw, ty
So, how do I access a blocks pdc?
is there a class like java.awt.Point, which also got width and height? If not you have any naming ideas lmao
vector2?
a point already has 2 dimensions
X and Y
how many dimensions do you need
yea and I want to store width and height so its probably a rectangle :D
I found a name lmao
only 2
bc I need to store width and height
bruh
a point is an object that stores 2 dimensions in a 2 dimension coordinate system
and that's what you need
a point doesn't know whether you call "x" "height"
you can freely use a "point" and use the "x" as "width" or as "age"
it doesn't care about that
a point is merely an object that stores two numeric values
no you are wrong, wait
and whether you use them for height or width or length or age, noone cares
ok
A point representing a location in (x,y) coordinate space, specified in integer precision.
thats what I mean and yea thats a rectangle
ooooh
I know what you mean
you want to save two points
the starting and end point
no I just want the top left corner and the width and height
then create your own datatype
^
yea
then just do it?
thats what Im doing it
good
but I needed a name and I was too stupid to come up with "rectangle" lmao
rip english lmao
yeah I know what you mean
I'd call it "region"
or "boundingbox"
but BoundingBox already exists in spigot and it has 3 coords
X,Y,Z
ok thanks :D
but yeah you do not need to store "origin", "width" and "length". You just need two points: "corner1" and "corner2"
probably should use a record for that
yea, but I want to do it like this: https://processing.org/reference/rect_.html
I think its also easier to use
if you want it to be mutable, then you cannot use records
yea you are right
I want to save multiple locations from a player, is there something better than java HashMap<UUID, HashMap<UUID, Location>> ?
isnt there a multimap
yes but that's for sth else
I forget that lists exist sometimes lmao
?
I want to save multiple locations from a player
as said: Map<UUID,List<Location>>
which of the 2 options do you recommend?
this
I'd use the Map<UUID,List<Location>> because it doesn't require any libs
MultiMap is not included in Java
Multimap is only available in guava, isn't it?
yea
exactly
a multimap is probably the better way but yeah maybe SOMETIME spigot would remove guava so
if you can do it without a library, better do it without a library
ight
its also called Multimap and not MultiMap 😭
idk its so unsatisfying
another reason not to use it lol
probably
One thing to notice here is that, although we have a list that has two elements in it, size() method returns 1. In Multimap, size() returns an actual number of values stored in a Map, but keySet().size() returns the number of distinct keys.
ugh I'd actually consider that a total downside
but that of course depends
just use whatever you think is better for your needs
I definitely would just use a plain Map<UUID,List<Location>>
yea
Im so bad at naming stuff ._.
I need to store a location for an Icon on an image and then I need to store a location for that Icon on a texture, where its from ._. and im completely lost :D
?paste
Did I do something wrong here? https://paste.md-5.net/wagotoqohe.cs
so I would use grounds.forEach method and I would change this:
if(locations != null) {
for(Location toDelete : locations) {
if(toDelete != null) {
p.getWorld().getBlockAt(toDelete).setType(Material.AIR);
}
}
}
to this:
if(locations.isEmpty()) {
return; // if void
}
locations.forEach(location -> {
if(location != null) {
// do stuff
}
});
@iron glade
thanks!
Looks cleaner
I would also change this:
p.getWorld().getBlockAt(toDelete).setType(Material.AIR);
```to:
```java
location.getBlock().setType(Material.AIR);
Okay, so is this the final result? https://paste.md-5.net/axunegusez.php
Or did I mess up smth now
why this SkyliftCommand.grounds.? just do grounds. or is grounds static?
yes it's static
👍
:D
Why does it spam the console saying player moved too quickly when I teleport them?
Uh
how are you teleporting him? with the vanilla command?
Intellij is being difficult and not downloading vault
I'm using maven to do it
[04:30:48 ERROR]: Could not load 'plugins/TestPlugin-1.0.jar' in folder 'plugins' org.bukkit.plugin.UnknownDependencyException: Unknown/missing dependency plugins: [Vault]. Please download and install these plugins to run 'TestPlugin'. at org.bukkit.plugin.SimplePluginManager.loadPlugins(SimplePluginManager.java:290) ~[patched_1.17.1.jar:git-Paper-411] at org.bukkit.craftbukkit.v1_17_R1.CraftServer.loadPlugins(CraftServer.java:419) ~[patched_1.17.1.jar:git-Paper-411] at net.minecraft.server.dedicated.DedicatedServer.initServer(DedicatedServer.java:287) ~[patched_1.17.1.jar:git-Paper-411] at net.minecraft.server.MinecraftServer.runServer(MinecraftServer.java:1220) ~[patched_1.17.1.jar:git-Paper-411] at net.minecraft.server.MinecraftServer.lambda$spin$0(MinecraftServer.java:319) ~[patched_1.17.1.jar:git-Paper-411] at java.lang.Thread.run(Thread.java:833) ~[?:?]
This is the error
I think that this is a vanilla issue
try and look if it logs moved to quickly when you use vanilla teleport
`<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>com.github.MilkBowl</groupId>
<artifactId>VaultAPI</artifactId>
<version>1.7</version>
<scope>provided</scope>
</dependency>
</dependencies>`
I hav the repository and dependency implemented
maybe use player#teleport(@NotNull Entity destination, @NotNull PlayerTeleportEvent.TeleportCause cause)
Install vault
Its in my modules and dependencies
Ik its not the server
Its something wrong with the plugin
Bro
DOWNLOADED
show
It legit says it's not in the stack trace idk what to say
I can't ss here
So I can guarentee you vault isn't in the plugins folder
bru
If it is restart your server and it should work
the error literally says that you dont have Vault installed
^ idk what else to say lmao besides you don't have it
?
It's not in your plugin folder it's a dependency but vaulr legit can't be in your plugjns folder
Ok I got the message
;-;
You download the plugin and plop it in
Did
like this: Server->plugins->Vault and Server->plugins->YourPlugin
Got it
no via my own plugin with the .teleport(location() method
yea its a vanilla problem
does it cause any problems beside spamming the console?
no
Alright, then I just have to ignore it I guess
maybe if you got any AntiCheat plugins on the same server, but idk
idk, but you can stop it and start another one later
or that
You'd either need to write your own impl or stop and start it as squid said
new BukkitRunnable{
@Override
public void run() {
if (runnableIsPaused) return;
}
}
yeah but that's an ugly way to do it
it is
So instead of using normal water around a spawn area, how would I write something to cancel fall damage for players in relation to a faction's claim.... (Using saber facs, might have to be a dependency)
?jd-s
Do you think I'd have to use saber as a dependency?
listen to entity damage event, check if last damage cause is fall damage and if so cancel the event
well unless you know all the claims beforehand you'd need to figure out when a player is in a zone somehow
And if my plugin is dependent on saber can I get the zones as defined within saber?
probably? Read their docs to find out
I'm not sure if they have any but I'll look
it depends on how saber's coded
if there isnt any docs you could decompile the plugin and figure out how its done
I have a repeatingTask runnable that stops when a player leaves but doesn't resume when he joins back
I suppose, thank you for the help I'll send for more help if needed
I mean I have if(player != null) in the runnable
that's how it "stops" when the player leaves
player changes whenever u leave and rejoin
shouldn't it automatically run again as soon as he joins back?
so it keeps checking even if the player leaves?
makes sense
so I'd compare the UUID instead
Currently yes but I'm gonna just restart it as soon as he joins back I guess
and completely stop it when he leaves
and remove the useless player != null check
yes
sounds like a #help-server problem
Thank
I tried to make this MobEffect plugin yesterday and have been testing making tweaks, still can't get it to work... any idea why? ```
static final EntityType SPIDER = EntityType.SPIDER;
@EventHandler
public void MobHitEvent(EntityDamageByEntityEvent e) {
if (e.getEntity() instanceof Player) {
Player player = (Player) e.getEntity();
if (e.getEntity().getLastDamageCause().equals(SPIDER)) {
player.sendMessage(ChatColor.DARK_RED + "You have been given poison from the spider bite!");
player.addPotionEffect(new PotionEffect(PotionEffectType.POISON, 8, 1));
is there a way to debug/test your code?
test server
yea, but I mean debugging where you can see variable values with breakpoints etc
Most hosts should send you a numbered java line where a piece of code went wrong if thats what you're asking
but I dont get an error :D
Well then debugging is going to be a complete bitch
I'm not aware of anything you could use to test the code other than a test server and if you don't get an error, which is the problem I'm having, it's really hard to find what is wrong
yea, I cant test a few classes with just prints in console
I suppose that could work, it just seems like you could only go so far with testing what needs to be tested, as in, if you have player only related conditional statements
or something along those lines
things you cant necessarily test with console prints
yea
I would just keep that in mind
if anyone can help, tag me please
I think this is the problem: e.getEntity().getLastDamageCause().equals(SPIDER)
getLastDamageCause returns EntityDamageEvent
How should I define the player getting hit by a spider?
try e.getDamager().equals(SPIDER)
do .getCause() from that
from the damage event
I think he wants to check if the damager is a Spider
a specific spider or just a spider?
So like if (e.getEntity().getLastDamageCause().getCause().equals(SPIDER))
any spider
To implement gun recoil right now I teleport the players head up a certain distance by taking current pos and adding to pitch and yaw. It's really choppy and buggy though when moving at the same time. Is there a way to mitigate that?
try do .getDamager() or something
just do this
yeah just use e.getDamager().getType()
Cannon resolve method getDamager
its fine
yea I forgot getType
from entitydamagebyentity?
if (e.getDamager().equals(SPIDER)) gives no errors, is this how I should have it?
and yes, yada0
getType
like this and then equals SPIDER
got
EntityType.SPIDER
it
its an enum


