#help-development
1 messages · Page 1578 of 1
public static Set<Entity> projectiles = new HashSet<Entity>(); or something idk
I'm so dumb
Ah right
look right
HashSet<Entity> 😬
Why you are returning a boleen when u set or remove ?
?
I just set that temporarily, I'm going to return the new set
Is there something wrong with it?
I mean just has the weird chance of actually just being a memory leak
Iavs 5 do u need specify in the hashset the type of value
if you are just trying to check if your snowball is, lets say, a custom snowball or smth
use pdc instead
these sets are only really useful if you need to iterate over the existing snowballs or have a bunch of data to assign
I'm trying to add trails to the snowballs
But
okay yeah, set seems good for that
How u are do this ?
Bad english sorry
scheduleSyncRepeatingTask and a loop of the set
oh, why sync if you are just sending particles
they can live fully off the main thread (particles that is)
what would it be then?
declaration: package: org.bukkit.scheduler, interface: BukkitScheduler
the EntityDamageEvent.DamageCause works but the getEntityType() uses the default message
isn't that depreciated?
tho really, just use https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/scheduler/BukkitScheduler.html#runTaskTimerAsynchronously(org.bukkit.plugin.Plugin,org.bukkit.scheduler.BukkitRunnable,long,long)
declaration: package: org.bukkit.scheduler, interface: BukkitScheduler
That one is deprecated for sure
Because it takes a BukkitRunnable lol
I assume you meant the other one lmao
give me a sec
😌
Wait confused
so which one should I use?
I never used consumer
doesn't that one require a period?
a period ?
Thr fiest long is a delat to ststt
just plug 0 there
Also for the snowball land I could just use entity damage right? that way it clear them if they land in the void
So async can run a custom thread too ?
It will execute the runnable on a cached thread pool
Or in one rather
I believe it still gets ticked like usual, just the execution is different
is the PlayerQuitEvent going to run before the player quits or after
idk like when they click quit it runs and then they quit fo real
i mean the client will know
Not exactly when they click but like as soon as the server gets to know about that
Necessarily not
You could randomly dispatch an ALT F4
well yeah but the quit button
Fair
and also what if they override the alt f4 key
Maybe someone decides to kick their pc such that it results in malfunctioning
not with that attitude

got nothing to say about that lol
Hopefully that shouldn’t happen lol
can always hire people and send them out with a button to go and find and stare through your players bedroom windows to see if they are about to quit, then press the button so it transmits that so the server knows

hire robots*
cuz people are shit at they job
Its been a long time since I've updated my plugins. Which spigot version should I be adding as an external dependency? For the most backward compatibility
yes
version-R0.1-SNAPSHOT
for maven ```<repositories>
<!-- This adds the Spigot Maven repository to the build -->
<repository>
<id>spigot-repo</id>
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
</repository>
</repositories>
<dependencies>
<!--This adds the Spigot API artifact to the build -->
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
<version>1.17-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
</dependencies>```
@granite stirrup so I should be using the latest spigot version from now on? back in 1.15.2 I was using 1.13.2 as an external dependency to maintain backward compatibility
no
you use the one for your version
but if you want you can use the 1.17 api
but make sure you specify api-version
and dont use 1.17 specific api things
ahhh right in the plugin.yml
Thanks. Yeah the reason why I asked cus I had bug reports for my plugin but only in 1.17.1, works in 1.16.2. So I thought maybe something in 1.17 api introduced a breaking change
haha yeah, I was still around to 1.15.2 so I have been using that
thanks again~
No nms, only pure API. All about having 1 version that a last foreverrrrr haha
I'm going to investigate now, but had something to do with plugin making creative flying an issue. (Of the of spells in the plugin toggles flight mode, so will have to see if anything changed there)
Does anyone have an example of using the worldedit API
I just want to do //replace lmao
I've skimmed through that before, it seems like I just need to loop over every block in a WE selection and replace them
Why even use the API if thats how you do it
yeah WE has a lot more than just blocks in an area
lame
what do you mean by "complete it every time"? :)
How would I start out learning how to create plugins?
?learnjava
Here are some links to get you started on learning Java:
- https://www.codecademy.com/learn/learn-java
- https://www.sololearn.com/learning/1068
- https://www.learnjavaonline.org/
- https://programmingbydoing.com/
- https://docs.oracle.com/javase/tutorial/java/index.html
The last one is the only official one, however some of those concepts assume that you already know a bit about programming.
Thx
He needs to know Java first tho if he doesn’t
He sent some Java things
Yeah, go for that first.
Ok
how can I fix this error that occurs when I itirate thru this hashset?
[20:06:50 WARN]: [LearningSpigot] Task #29487 for LearningSpigot v1.0-SNAPSHOT generated an exception
java.util.ConcurrentModificationException: null``
This the where the error throws
public class snowBallEffect implements Runnable {
public static Set<Entity> projectiles = new HashSet<Entity>();
public void run() {
if (projectiles != null){
projectiles.removeIf(Objects::isNull);
for (Entity projectile : (projectiles)) {
if (projectile != null){
if (projectile.getLocation().getY() > 0) projectile.getWorld().spawnParticle(Particle.HEART, projectile.getLocation(), 5, 0,0,0);
else {
projectiles.remove(projectile);
projectile.remove();
}
}
}
}
}
public static boolean addProjectile(Entity e){
projectiles.add(e);
return true;
}
public static boolean removeProjectile(Entity p){
projectiles.remove(p);
return true;
}
}
@granite beacon
Don't remove stuff from the Set (projectiles) while looping through the set...
So I should make an array and then remove them after?
Yes
Gotcha, wouldn't that come at performance issues since it's on a 2 tick timer?
Or nothing important enough care about
If you remove it within the for loop or after the for loop should not matter, but it always depends on the size of the set i guess 😄
Yeah the issue only seems to happen when the set is above 4 and the projectiles get removed closely from each other.
ConcurrentModificationException just means you try to modify the Set/List/what ever while your looping through it, so you HAVE to remove it after 😄
how to delay a method?
Use an iterator rather than a second set
for (int x = edgeMin.getBlockX(); x <= edgeMax.getBlockX(); x++) {
for (int y = edgeMin.getBlockX(); y <= edgeMax.getBlockX(); y++) {
for (int z = edgeMin.getBlockX(); z <= edgeMax.getBlockX(); z++) {
Block block = new Location(world, x, y, z).getBlock();
if (block.getType() == Material.AIR
|| block.getType() == Material.FIRE
|| block.getType() == Material.TNT) {
int rand = new Random().nextInt(100);
if (rand == 1) {
block.setType(Material.DIAMOND_BLOCK);
} else if (rand == 2) {
block.setType(Material.EMERALD_BLOCK);
} else if (rand == 3) {
block.setType(Material.IRON_BLOCK);
} else if (rand < 14) {
block.setType(Material.COBBLESTONE);
} else if (rand < 35) {
block.setType(Material.NETHERRACK);
} else {
block.setType(Material.STONE);
}
}
}
}
}
LOL
no world edit api needed
the equivalent of //replace fire,0,tnt 60%stone,27%netherrack,10%cobblestone,1%diamond_block,1%emerald_block,1%iron_block
i think
someone is bypassing my proxy
but idk how
i have bungeeguard
the ip is 127.0.0.1
people i know
are joining then immediately every 10s
on the dot
10s
like
my friends account
is being used for this
bungeecord: true
offline mode is true
3 people at the same time
why are you sending this in the wrong channel and in 10 messages
yes
bruh
but then nobody can join without bungeecord
what does that even mean
what do you meeaaannnnn
bungeecord's not a client
idk what you mean
yes
i cant help im sorry
i think he means that bungeecord is supposed to act as a proxy to his other servers, but they are joining without going through bungeecord
yes
LUL
i made it pretty clear
misconfigured configurations i see
nope
no you did not
make sure all your servers are in offline mode
they are
idk then thats as far as my bungeecord knowledge goes lol
is bungeecord: true in all of them?
yes
they shouldnt be able to bypass this at all
unless you have misconfigured something
i have not
i have
i have like
did you check your config.yml in your Bungeecord proxy
yes
ok ok so let me get this right
someone with the IP 120.0.0.1, is bypassing your Bungeecord proxy?
or did i get that wrong
no
he is saying that the ip is set to 127.0.0.1 in the config
yes
no
the actual IP
is bungeecord: true set in your spigot.yml
127.0.0.1 is your localhost IP
yes
i know
Why are you fighting with them?
how does that fix anything??
dude without 127.0.0.1 people can join without joining through bungeecord
then you have misconfigured something
i learned that the hard way
I have to agree with you.
I too, must agree with thine
Cause I have it where no one can bypass my hub except for staff
i dont even run Bungeecord
ok so i just put bungeecord: true in spigot.yml and i cant even join my own server (thats all i changed)
wait what
wdymmmmm
so you either dont have that set to true, or you might have ip forwarding set to true in your bungeecord config (Although IP forwarding might be unrelated)
Bungee cord you have a proxy for it to work
@torn oyster
what
read.this
of course i have ip forwarding on
otherwise nobody can join
wtffffff
bro
thats not how that works
do you even know what it does
no hes right
is he?
yes
did Bungeecord change
ip foward
odd i thought IP forwarding didn't allow users to join
it is another security measure
NOT A GOOD IDEA BTW
LOL
Take a look at this https://github.com/lucko/BungeeGuard
i haven't
check EVERY configuration
again
that relate to bungee
.
LOL
i've done it 3 times
then you misconfigured something.
what a surprise
I copied the loop from some random stack overflow
gg
I'm going to make this work
Hi going to make this work, I'm gecko
My hatred of the WE api overpowers the bad code
Might be an issue with BungeeGuard, there are some reports of it not working on the github
Check Dns and get tcp shield. Also enable ip forwarding if you have any kind of login plugin
How do you delay a task being run?
Any help would be appreciated
?scheduling
is it possible to use a dependency is a local way between the plugins in the plugin folder?
im trying to recreate vault with a few other details i want, but this will only be used in a local way
i have no idea how to face this problem
Do you mean use a plugin as a dependency without shading?
yea idk tbh, i want to have 1 plugin (take vault as an example) that we are gonna call secondVault, i want to do the things vault allows like, vault.getBalance, vault.getBank, etc, but i want to do it with my own plugin, do i have to shade it and make it a dependency even tho its a local plugin?
or a sql database
that other plugins can acces
Sick! I finally got it working @chrome beacon
no, if you just put the plugin jar in your plugins folder, it will be accessible from any other plugin
the only thing to be aware of is that if you try to access the "secondVault" api and it isnt actually in the plugins folder a class not found error will be thrown
also you have to make sure that you have it as a dependency in maven/gradle but you dont shade it. In gradle you do that by just using compileOnly, im not sure about maven
yea lets assume both plugins are in the same plugin folder , both working properly
what should i use to acces it?
i see
when i run package it doesnt shade it right?
You can access it directly from java code. It's exactly the same as how you access Bukkit code. You (usually) dont shade bukkit directly into your plugin, but you can still access all Bukkit classes because the server already has it
If you are using Maven then I can't really help you much with shading, since I pretty much just use gradle. I believe that maven requires a plugin to shade and it wont do it by default though
why are you shading it
do i have to add anything?
like an import or smth?
just install it locally
how is this called so i can google it?
You still have to import everything, just like you would with bukkit code
and you can add it as a dependency
Sadly I cant really help you set up the dependency since it sounds like you are using maven and i havent used maven since in years, you might have to turn to google for that unless someone else here can help you
k thx
someone knows how i can do that in java?:
reveal player from all players
lol what
What's reveal in skript ?
reveal player from all players
skript
What do reveal operator do ?
what
Ok for me reveal is an uhc scénario x)
probably just sets them to be visible/invisible. You can do that with LivingEntity.setInvisible()
Or you can try something like that
for(Player player: Bukkit.getOnlinePlayers()) { player.hidePlayer(plugin.getInstance(), p); player.showPlayer(plugin.getInstance(), p); }```
hey so how do i get protected land on my mc 1.17 server w/ my friends
u ask them really nicely to not touch anything
wrong channel
mbmb
this one mfs threatening to blow up my friends shit and it took her a rly long time so im tryna be nice 😩
java.lang.NullPointerException: Cannot invoke "org.bukkit.block.Block.getLocation()" because the return value of "org.bukkit.event.player.PlayerInteractEvent.getClickedBlock()" is null
at com.ankledev.nectar.serverevent.Server.onInteract(Server.java:188) ~[?:?]
at com.destroystokyo.paper.event.executor.asm.generated.GeneratedEventExecutor5.execute(Unknown Source) ~[?:?]
at org.bukkit.plugin.EventExecutor.lambda$create$1(EventExecutor.java:69) ~[patched_1.17.jar:git-Paper-79]
at co.aikar.timings.TimedEventExecutor.execute(TimedEventExecutor.java:80) ~[patched_1.17.jar:git-Paper-79]
at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:70) ~[patched_1.17.jar:git-Paper-79]
at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:624) ~[patched_1.17.jar:git-Paper-79]
at org.bukkit.craftbukkit.v1_17_R1.event.CraftEventFactory.callPlayerInteractEvent(CraftEventFactory.java:538) ~[patched_1.17.jar:git-Paper-79]
at org.bukkit.craftbukkit.v1_17_R1.event.CraftEventFactory.callPlayerInteractEvent(CraftEventFactory.java:501) ~[patched_1.17.jar:git-Paper-79]
at org.bukkit.craftbukkit.v1_17_R1.event.CraftEventFactory.callPlayerInteractEvent(CraftEventFactory.java:496) ~[patched_1.17.jar:git-Paper-79]
at org.bukkit.craftbukkit.v1_17_R1.event.CraftEventFactory.callPlayerInteractEvent(CraftEventFactory.java:492) ~[patched_1.17.jar:git-Paper-79]
at net.minecraft.server.network.ServerGamePacketListenerImpl.handleAnimate(ServerGamePacketListenerImpl.java:2223) ~[?:?]
at net.minecraft.network.protocol.game.ServerboundSwingPacket.handle(ServerboundSwingPacket.java:25) ~[?:?]
at net.minecraft.network.protocol.game.ServerboundSwingPacket.handle(ServerboundSwingPacket.java:7) ~[?:?]
at net.minecraft.network.protocol.PacketUtils.lambda$ensureRunningOnSameThread$1(PacketUtils.java:36) ~[?:?]
at net.minecraft.server.TickTask.run(TickTask.java:18) ~[patched_1.17.jar:git-Paper-79]
at net.minecraft.util.thread.BlockableEventLoop.doRunTask(BlockableEventLoop.java:149) ~[?:?]
at net.minecraft.util.thread.ReentrantBlockableEventLoop.doRunTask(ReentrantBlockableEventLoop.java:23) ~[?:?]
at net.minecraft.server.MinecraftServer.doRunTask(MinecraftServer.java:1340) ~[patched_1.17.jar:git-Paper-79]
at net.minecraft.server.MinecraftServer.shouldRun(MinecraftServer.java:193) ~[patched_1.17.jar:git-Paper-79]
at net.minecraft.util.thread.BlockableEventLoop.pollTask(BlockableEventLoop.java:122) ~[?:?]
at net.minecraft.server.MinecraftServer.pollTaskInternal(MinecraftServer.java:1319) ~[patched_1.17.jar:git-Paper-79]
at net.minecraft.server.MinecraftServer.pollTask(MinecraftServer.java:1312) ~[patched_1.17.jar:git-Paper-79]
at net.minecraft.util.thread.BlockableEventLoop.managedBlock(BlockableEventLoop.java:132) ~[?:?]
at net.minecraft.server.MinecraftServer.waitUntilNextTick(MinecraftServer.java:1273) ~[patched_1.17.jar:git-Paper-79]
at net.minecraft.server.MinecraftServer.runServer(MinecraftServer.java:1184) ~[patched_1.17.jar:git-Paper-79]
at net.minecraft.server.MinecraftServer.lambda$spin$0(MinecraftServer.java:320) ~[patched_1.17.jar:git-Paper-79] at java.lang.Thread.run(Thread.java:831) [?:?]
any idea why thats happening
player clicked air
there is no clicked block
check the event is a click block event
yeah, i have an if statement to see if the block is null
should i rather check if its Material.AIR?
if you checked if getClickedBlock() is null then you cant get a null pointer exception (unless you checked it but just ignored it)
Action action = event.getAction();
if (action != Action.RIGHT_CLICK_BLOCK && action != Action.LEFT_CLICK_BLOCK) return;```
show your code
@EventHandler
public void onInteract(PlayerInteractEvent e){
if(e.getClickedBlock() != null || Main.getInstance().isVanished(e.getPlayer()) || Main.getInstance().isInSpawn(e.getClickedBlock().getLocation())){
e.setCancelled(true);
}
}
OH
that's || or
🤦♂️
i configured something wrongly.
isInSpawn lol
should be (check if null) && or || or
¯_(ツ)_/¯
what else should i do for isInSpawn
its just checking coordinates lol
check if they're in between 2 points
if x is <= # and y <= # and z <= # and x >= and y >= # and z >= #
then in spawn
yeah thats what isInSpawn does
theres multiple events that has isInSpawn, its supposed to be so i can just change it easily
Nope, it was added 1.16
no
support for § has always existed before spigot right?
alright by 1.16 you mean 1.16 spigot or 1.16 minecraft
since i know §x is the prefix for hex
Both
but it works in vanilla MC too ?
Yeah the §
Thanks, thats all i wanted to know. Im trying to make my plugin support spigot, fabric, all the things by making it agnostic so as of right now i have things like PlatformPlayer and PlatformPlugin and PluginContext and such but I was just making sure i wouldnt need to do some bullshit like ColorProcessor implementations
i was under the impression § was a spigot/bukkit thing and not a MC thing
I'm pretty sure it's a Minecraft thing
Yep, just wanted to confirm. Thanks
Quick confirmation, trying to run BuildTools to make 1.17.1 with Java 17. Is it correct that there is a hard limitation that 1.17 version can only be created with Java 16?
How would I go about stopping entities from despawning?
Im getting a "Could not initialize class a" error inside of this class. Specifically the updateSign(); method or these variables. String world = Bukkit.getWorld("manhunt").toString(); Block b = Objects.requireNonNull(Bukkit.getServer().getWorld(world)).getBlockAt(0,66,2); Sign sign = (Sign)b.getState(); https://paste.md-5.net/akudoqawan.java
I feel like its something to do with my World and my block
Can you send your InteractHandler class
I tried deleting the updateSign() method along with the variables and it ran properly.
What is a?
i just needed it that way i can access that instance across my whole project
not sure if theres a better way to do that
Are you sure the a class is included in your JAR?
but i removed the 3 variables i had and did something different and it worked ??
i used World world = Bukkit.getWorld("manhunt"); Block b = world.getBlockAt(0, 66, 2); Sign sign = (Sign) b.getState(); instead
how do i run command like a datapack i want to run this stuff on startup
scoreboard objectives add Level dummy {"text":"Level","bold": true, "color": "#ff5e5e"} scoreboard objectives add XP dummy {"text":"XP","bold": true, "color": "#5edaff"} scoreboard objectives setdisplay sidebar Level scoreboard players add @a Level 0 scoreboard players add @a XP 0 scoreboard objectives add Speed dummy scoreboard objectives add Health dummy scoreboard objectives add Damage dummy scoreboard objectives add Atkspeed dummy scoreboard objectives add Armor dummy scoreboard players add @a Armor 0 scoreboard players add @a Atkspeed 0 scoreboard players add @a Damage 0 scoreboard players add @a Health 0 scoreboard players add @a Speed 0
ok
im still having issues
[13:02:56 ERROR]: Could not pass event PlayerInteractEvent to Nectar v1.0
java.lang.NullPointerException: Cannot invoke "org.bukkit.block.Block.getType()" because the return value of "org.bukkit.event.player.PlayerInteractEvent.getClickedBlock()" is null
at com.ankledev.nectar.serverevent.Server.onInteract(Server.java:196) ~[?:?]
at com.destroystokyo.paper.event.executor.asm.generated.GeneratedEventExecutor7.execute(Unknown Source) ~[?:?]
at org.bukkit.plugin.EventExecutor.lambda$create$1(EventExecutor.java:69) ~[patched_1.17.jar:git-Paper-79]
at co.aikar.timings.TimedEventExecutor.execute(TimedEventExecutor.java:80) ~[patched_1.17.jar:git-Paper-79]
at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:70) ~[patched_1.17.jar:git-Paper-79]
at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:624) ~[patched_1.17.jar:git-Paper-79]
at org.bukkit.craftbukkit.v1_17_R1.event.CraftEventFactory.callPlayerInteractEvent(CraftEventFactory.java:538) ~[patched_1.17.jar:git-Paper-79]
at org.bukkit.craftbukkit.v1_17_R1.event.CraftEventFactory.callPlayerInteractEvent(CraftEventFactory.java:501) ~[patched_1.17.jar:git-Paper-79]
at org.bukkit.craftbukkit.v1_17_R1.event.CraftEventFactory.callPlayerInteractEvent(CraftEventFactory.java:496) ~[patched_1.17.jar:git-Paper-79]
at org.bukkit.craftbukkit.v1_17_R1.event.CraftEventFactory.callPlayerInteractEvent(CraftEventFactory.java:492) ~[patched_1.17.jar:git-Paper-79]
at net.minecraft.server.network.ServerGamePacketListenerImpl.handleAnimate(ServerGamePacketListenerImpl.java:2223) ~[?:?]
at net.minecraft.network.protocol.game.ServerboundSwingPacket.handle(ServerboundSwingPacket.java:25) ~[?:?]
at net.minecraft.network.protocol.game.ServerboundSwingPacket.handle(ServerboundSwingPacket.java:7) ~[?:?]
at net.minecraft.network.protocol.PacketUtils.lambda$ensureRunningOnSameThread$1(PacketUtils.java:36) ~[?:?]
at net.minecraft.server.TickTask.run(TickTask.java:18) ~[patched_1.17.jar:git-Paper-79]
at net.minecraft.util.thread.BlockableEventLoop.doRunTask(BlockableEventLoop.java:149) ~[?:?]
at net.minecraft.util.thread.ReentrantBlockableEventLoop.doRunTask(ReentrantBlockableEventLoop.java:23) ~[?:?]
at net.minecraft.server.MinecraftServer.doRunTask(MinecraftServer.java:1340) ~[patched_1.17.jar:git-Paper-79]
at net.minecraft.server.MinecraftServer.shouldRun(MinecraftServer.java:193) ~[patched_1.17.jar:git-Paper-79]
at net.minecraft.util.thread.BlockableEventLoop.pollTask(BlockableEventLoop.java:122) ~[?:?]
at net.minecraft.server.MinecraftServer.pollTaskInternal(MinecraftServer.java:1319) ~[patched_1.17.jar:git-Paper-79]
at net.minecraft.server.MinecraftServer.pollTask(MinecraftServer.java:1312) ~[patched_1.17.jar:git-Paper-79]
at net.minecraft.util.thread.BlockableEventLoop.managedBlock(BlockableEventLoop.java:132) ~[?:?]
at net.minecraft.server.MinecraftServer.waitUntilNextTick(MinecraftServer.java:1273) ~[patched_1.17.jar:git-Paper-79]
at net.minecraft.server.MinecraftServer.runServer(MinecraftServer.java:1184) ~[patched_1.17.jar:git-Paper-79]
at net.minecraft.server.MinecraftServer.lambda$spin$0(MinecraftServer.java:320) ~[patched_1.17.jar:git-Paper-79]
at java.lang.Thread.run(Thread.java:831) [?:?]
?paste
paste the error?
try to not send massive texts please
send code
even before i added to check if its Material.AIR, which i just removed
it'd send rthe error
boop
wait
thats outdated
@EventHandler
public void onInteract(PlayerInteractEvent e){
if(e.getClickedBlock() != null && Main.getInstance().isVanished(e.getPlayer()) || Main.getInstance().isInSpawn(e.getClickedBlock().getLocation())){
e.setCancelled(true);
}
}
and then before the && i had another || e.getClickedBlock().getType()
although with that code it'll still send the rror
if im reading this right
do a return if it is null
im checking if the block is null, and IF the player's vanished, OR the block is in spawn
if(object is null) return
alr, its just odd because this doesnt happen on any other event
since you have it check a && then if the player isn't in vanish it will still run the or
which getlocation can't do if its null to begin with
yeah
whats the error of this code?
i had a || after seeing if it wasn ull checking if it was Mateiral.AIR
^
how do i run command like a datapack
replace conditions in the if with (condition) && ( (condition) || ( condition) )
like in code?
@EventHandler
public void onInteract(PlayerInteractEvent e){
if(e.getClickedBlock() != null || e.getClickedBlock().getType() != Material.AIR && Main.getInstance().isVanished(e.getPlayer()) || Main.getInstance().isInSpawn(e.getClickedBlock().getLocation())){
e.setCancelled(true);
}
}
what
or just do a return if null
either one works
yup
i want to run this stuff on startup
scoreboard objectives add Level dummy {"text":"Level","bold": true, "color": "#ff5e5e"}
scoreboard objectives add XP dummy {"text":"XP","bold": true, "color": "#5edaff"}
scoreboard objectives setdisplay sidebar Level
scoreboard players add @a Level 0
scoreboard players add @a XP 0
scoreboard objectives add Speed dummy
scoreboard objectives add Health dummy
scoreboard objectives add Damage dummy
scoreboard objectives add Atkspeed dummy
scoreboard objectives add Armor dummy
scoreboard players add @a Armor 0
scoreboard players add @a Atkspeed 0
scoreboard players add @a Damage 0
scoreboard players add @a Health 0
scoreboard players add @a Speed 0
replace getType to isAir
and add the ( )
for the conditoin
s
im already return-ing if its null
its just easier
use
?paste
replace it with
?snipe
no offence but that if statement is awful
😳
ur sentence is awful
Sentence.
i know
bro who are you
^^^^ my name
idk you sry
me neither
how would i run these on startup
use scoreboard stuff
nice return
add it in the onEnable
ye can someone tell me how to change the 0 of the the scoreboard (below name) to something like 69
uhhhhhh
thats an objective below the name, yes?
ye
setScore(69);
so i just can put that in my onEnable or onload and it will work when my plugin starts
doesnt work
uhhh
this doesnt work
declaration: package: org.bukkit.scoreboard, interface: Score
can you show some code?
private Scoreboard createScoreboard(String Ewen_Is_Fat_XD) {
final Scoreboard scoreboard = Bukkit.getScoreboardManager()
.getNewScoreboard();
final Objective objective = scoreboard.registerNewObjective(
"test", "dummy",
ChatColor.RED + "Ewen_Is_Fat_XD" + ChatColor.RESET + " 0");
objective.setDisplaySlot(DisplaySlot.BELOW_NAME);
objective.setDisplayName(ChatColor.RED + "Ewen_Is_Fat_XD" + ChatColor.RESET + " 0");
return scoreboard;
so?
First of all, change BELOW_NAME to SIDEBAR
Hey
no.
No? You're making a scoreboard right?
ye
Look at this example https://www.spigotmc.org/threads/how-to-make-a-scoreboard.298257/#post-2849814
am i doing something wrong? im following this tutorial https://www.spigotmc.org/wiki/creating-external-libraries/
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
i want to share methods between plugins
wait you cant see shit
did you compile the library on your device already
i believe you might need to for the dependency to work
hm no its not that
i cant use InfinityChatApi.setPlugin(this) either
its missing a link i cant find
if it's your own library
make sure you compiled it with maven
in the first place
and the group, artifact, and version are exactly what you put
i copied it from the pom of the API
uh i usually do a mvn clean install
u can try that maybe
also make sure u reload ur pom.xml
on ur other project
am not a maven nerd no hate tanx
@sharp bough Thats not going to work unless you have your api in a repository
Although if you're making an API for everyone to use, you probably want to publish it to a remote repository. jitpack.io makes this pretty simple.
Then just using the local jar is fine, although a bit harder
hyd
im following this
im downloading mvn
see if that works
and then install it
in my local repostory
Doing fine, what about you?
anyone know what event is called when a hopper picks up an item
im good
ty
InventoryMoveItemEvent i believe
are you retarded
thats inventory to inventory, sorry
but like
dont be rude??
and then you replied to it
human error exists, we aren't perfect robots
damn gecko chill dude
yeah
i didnt understand BanePig's question 1000%, and didnt see that you had answered it
actually i needed InventoryMoveItemEvent too
im getting this error
glad i could help
yeah idk either thats a step up from my level 2 java noob sorry lmao
is infinity chat api your api
that's not even java
its maven, which is used in java development
but don't respond to a question if you have nothing to contribute and just want to say "idk"
?paste your pom, lucas
yea
its in the plugins folder
https://paste.md-5.net/vahugunibo.xml the plugin requesting the API
https://cwiki.apache.org/confluence/display/MAVEN/NoGoalSpecifiedException did you look at this
error line 88+
oh i just noticed you included to cli args
well for installing the plugin you got an access denied error
just make sure you're not running the server while using that
and then mvn -e just does nothing
Hmm did World.generateTree break? Work in 1.16.5 but cant get it working in 1.17.1
and the goal is correct,
No goals have been specified for this build. You must specify a valid lifecycle phase or a goal in the format <plugin-prefix>:<goal> or <plugin-group-id>:<plugin-artifact-id>[:<plugin-version>]:<goal>. Available lifecycle phases are: validate, initialize, generate-sources, process-sources, generate-resources, process-resources, compile, process-classes, generate-test-sources, process-test-sources, generate-test-resources, process-test-resources, test-compile, process-test-classes, test, prepare-package, package, pre-integration-test, integration-test, post-integration-test, verify, install,
im not
Do anybody knows what packets should send when player join the world
thx
well its hard to say why you're getting an access denied error then, maybe try running as admin
this one is an admin
i have no idea whats wrong
wdym this one is an admin?
maybe theinstall:install-file is wrong?
this cmd
if you run as admin you should start in C:\Windows\system32
cuz it says <plugin-prefix>:<goal>
did you change dir?
did you still get an access denied error
yea
then there must be some program already using the jar file
Are you able to delete the jar file? (You can just restore it Ctrl+Z after)
hm
wait let me change the dir
C:\Windows\System32>mvn install:install-file -Dfile=C:\Users\LucasUser\Desktop\Server\plugins -DgroupId=me.paradis -DartifactId=InfinityChatApi -Dversion=1.0-SNAPSHOT -Dpackaging=jar
To top it off, if I place a sappling on the same block and bone meal it, the tree can grow
i think you forgot the version after
like InfinityChatApi-1.0-SNAPSHOT.jar
i think it was
👍
does that mean it works
will probably work then
it does
thats such a nice way of going to bed
i should of have gone to bed like 5 hours ago
lmao
aight gn
and thx
gn and np
I'm creating a login plugin with ChannelDuplexHandler
Maybe cuz your sending all at once?
Thats what i'm doing
You might need to add a little delay
¯\_(ツ)_/¯
and also the removeLimit didn't execute
What's packets =
All the packets when player joins game
Check?
what? the packets type?
i created a function to add scoreboard to players, but it doesn't work and i saw no errors in the sv console. is it changed? cause IDE says manager.getNewScoreboard(); MayProduceNullException
private static void ScoreHandler(Player player){
ScoreboardManager manager = Bukkit.getScoreboardManager();
Scoreboard board = manager.getNewScoreboard();
Objective objective = board.registerNewObjective("Main","",ChatColor.GOLD+"/-"+ChatColor.GREEN+"ATMOS"+ChatColor.GOLD+"-/");
Score spacer1 = objective.getScore(" ");
Score onlineCount = objective.getScore(ChatColor.GREEN+"-Online :"+ChatColor.RED+String.format(" %d", player.getServer().getOnlinePlayers().toArray().length));
Score spacer2 = objective.getScore(" ");
Score icName = objective.getScore(ChatColor.GREEN+"-Your IC Name :"+ChatColor.RED+String.format("%s",player.getDisplayName()));
spacer1.setScore(1);
onlineCount.setScore(2);
spacer2.setScore(3);
icName.setScore(4);
player.setScoreboard(board);
}
@EventHandler
private static void onPlayerJoin(PlayerJoinEvent e){
Player p = e.getPlayer();
ScoreHandler(p);
}```
^^
@EventHandler
public void Join(AsyncPlayerPreLoginEvent event) {
new BukkitRunnable() {
@Override
public void run() {
if (Bukkit.getPlayer(event.getUniqueId()) ==null ) {
return;
}
Player player = Bukkit.getPlayer(event.getUniqueId());
scoreboard scoreboard = new scoreboard(player);
scoreboard.setLobbyBoard();
}
}.runTaskLater(Main.getInstance(),20);
}
}
what would Path.of be for 1.8?
Paths.get exist I believe
Is it possible to show the server resource pack agreement screen even after the user has declined it once?
thanks
Yeah il using this right now
But the problem with this is
After the player declines once they dint get the option to agree again
Correct. You can't override the client setting
So basically if they decline once then nothing can be done about it?
Not even giving them the option again?
They have to change the setting their end
And where would they do that?
No clue, its in the settings/options on the client somewhere
Hmm ok thanks
You could send them a nag message is all
use the setResourcePack method and monitor the PlayerResourcePackStatusEvent
The player can change their settings about resource pack on the server.
Basically click the server on the server list, and click edit.
There is Server Resource Pack option, and there is 3 option which is Enabled, Disabled, and Prompt.
Thankss
how can i remove < and > in the mc's chat?
Ye
how can I view the javadocs of previous spigot versions?
You cant
You can
Not officially?
Yeah not officially
Lol
no they didnt
😂
can someone help me i want to show the guild name in chat i used this format '&b[{guild}&b]&r{DISPLAYNAME}&7:&r {MESSAGE}' but it just says [{guild}] in chat anyone know which format i need to use
Chat plugin?
Essentials chat
I was looking for a placeholder format in my guild plugin but evrything i copyd dint work or do i need to make a placeholder for that in placeholderapi
Well if you want you can make a placeholder API placeholder and then use this https://www.spigotmc.org/resources/chatinjector.38327/ to use it in essentials chat
Ok thnx
That's the only way I know
Since essentials chat doesn't support placeholder plugins and it doesn't have custom placeholders
in this error
https://pastebin.com/rzjZLrkX
according to the stacktrace, is CUSTOM meant to be the field getting accessed?
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
this
setValidWorldTypes(new ArrayList<>(Arrays.asList(World.Environment.NORMAL, World.Environment.CUSTOM)));
it's only happening for one dude so far and I can't replicate it
Id assume that stack would come up if it was changed to something else
?
it's weird because it creates the class just fine and it runs the previous field just fine
just seems to hang up here
probably unrelated, my test environments are on 1.17 right now but were 1.16.5 when I first made this feature, it worked on both just fine
never seen it happen before
also depending on the order in which reflections are accessing this package it might not even be the first instance of this field getting set with these values
Custom config.java:56?
/**
* Initializes all configurations and stores them in a static list for later access
*/
public CustomConfig(String path, String packageName) {
this.path = path;
//Set defaults through reflections by getting everything that extends specific CustomConfigFields within specific package scopes
Reflections reflections = new Reflections(packageName, new SubTypesScanner(false));
Set<Class> classSet = new HashSet<>(reflections.getSubTypesOf(CustomSpawnConfigFields.class));
classSet.forEach(aClass -> {
try {
customConfigFieldsArrayList.add((CustomConfigFields) aClass.newInstance());
the cutoff is where it errors
Is the person using your plugin still getting the error
That is really strange
I suspect this might straight up be a corrupted download
Or his config is fucked up
so you cant recreate this bug yourself
Ask him to send his config
as in plugin config?
it's not his config
dont think config would effect it on this level
he just got it to work with me modifying stuff that didn't need to be modified
is he using a modified server jar?
i.e. declaring the environment array separately, filtering custom envs by version and running it
looks like it's paper? he is 200 versions behind but the version I just sent seems to work
The only thing that i could think of is its a heavily modified server jar that messes with that enum
yeah I might have to chalk this up either to a bad dl or a bad paper version
i would see no other reason
yeah I thought the code was relatively solid myself
and it was seemingly tested by quite a few servers ahead of time, really weird stuff
yeah about ~60 servers are reporting in with it working just fine, hrm
are you getting a stack trace
"/kill <sender>" works
but "/kill <target>" doesnt work
and says internal error
send the error pls
i still dont get the diff between getPlayer and getPlayerExact?
i dont think thats going to do anything with my issue
npe for set health
but not send message
interesting
you can compare player == target. if they are the same it will be the same object
instead of comparing names
worked!
but why was it causing the issue for "else if" one
sounds weird
Lol it says Craftserver:666
and else if(target instanceof Player) will always be true
target is Player in the first place
the point is to check if the target is online or not
yeah ik that, but that way wont work
what do u suggest then
.isOnline()
not sure if the getPlayerExact will return null if they are offline though
true?
yep
looks like it does
but isOnline looks better to me
thanks
and btw
i have another issue
im trying to disable the death message
whenever they execute that command
just for that event?
do i have to create a playerdeathevent?
or in general
hmm let me think
i was wondering if i can create a public boolean
and value it true once the command is executed
you could add the player to a list when the command is executed, check on the death event if they are in it then stop the message
but thats inefficient
have a look at this:
guys I solved the murder mystery
ou please tell
the reflections weren't working because of a bugged paper release
yeah knew it had to be the server jar
no one ever suspects the maid huh
was it just the one release or is it a persisting issue
what a fun round of clue we just had
alright same time next hour
Wtf is paste.gg
this is how i prevented the deathmessage in an example
try avoid using one boolean
private final List<UUID> deathList = new ArrayList<>();
@EventHandler
public void onDeath(PlayerDeathEvent event){
UUID uuid = event.getPlayer().getUniqueId();
if(deathList.contains(uuid){
event.setDeathMessage("");
deathList.remove(uuid)
}
}
would be a bit better
then add their uuid in the command
could you gimme the code for that too?
?spoon
Spoonfeed a newbie for a day and they'll come back with more questions. Teach them to find their own answers and you'll both be better off: you won't get stuck answering the easy questions and they'll be much more productive than before.
im not a professional at coding and im learning java beside with plugin development
oh
that is exactly what it’s saying. “Spoonfeed a newbie”
im not just copy pasting 😉
I currently try to create my first BungeeCord/Waterfall Plugin.
Right now i try to add a command with TabCompletion.
The command itself works fine but the TabCompletion don't work and the method onTabComplete don't even will be called.
I tried to search for that, but all i found is implementing the TabExecutor interface (which i do) and registering the command class (which i also do and which works, because the command itself works propper).
My minimal code: https://paste.md-5.net/lerisayefa.java
Does anybody has a idea ?
you need to setTabCompleter
How, i also thought that but i don't found it for BungeeCord.
declaration: package: org.bukkit.command, class: PluginCommand
thats for spigot
but should be same for bungee
No its not 😄
is that how it works?
oh i had to get the target's UUID
i guess
yep
how do i?
im so new to this it would be appreciated if u could help
Learn the basis, casting stuff is quite easy.
Just search on google how to cast.
@drowsy helm do you found anything ?
not, yet digging around
How do I get a chunk from x and z position?
Block.getChunk() or Location.getChunk()
Thanks
@regal lake https://github.com/aikar/commands/blob/master/bungee/src/main/java/co/aikar/commands/BungeeCommandManager.java looking through ACF, they dont do anything that you're not doing for command completion
public void registerCommand(BaseCommand command) {
command.onRegister(this);
for (Map.Entry<String, RootCommand> entry : command.registeredCommands.entrySet()) {
String commandName = entry.getKey().toLowerCase(Locale.ENGLISH);
BungeeRootCommand bungeeCommand = (BungeeRootCommand) entry.getValue();
if (!bungeeCommand.isRegistered) {
this.plugin.getProxy().getPluginManager().registerCommand(this.plugin, bungeeCommand);
}
bungeeCommand.isRegistered = true;
registeredCommands.put(commandName, bungeeCommand);
}
}
They also use the registerCommand method, which i also use.
so the event is not being called at all right
https://github.com/aikar/commands/blob/f033dd9541eee468cb05a96db0097ea493f9ec5b/bungee/src/main/java/co/aikar/commands/BungeeRootCommand.java
There is also the TabExecutor interface.
So they do the same as i do :/
yeah that is strange
its not being called right
the event
or have you not tested it
The method onTabComplete will not be called.
Yes, tested it with System.out.println("onTabComplete");
hmm
only other possibility is its not registering at all?
have you made sure teh command itself executes
Hello when i try to register 2 commands non of the commands execute, but if i only register 1 it executes.
Main: https://paste.lucko.me/xpS49A8m1q
Duck Reload Command: https://paste.lucko.me/9JmRaDxZtz
Test Command: https://paste.lucko.me/Z1b0U6kwgZ
Plugin YML: https://paste.lucko.me/yod1un1Gkh
@drowsy helm found the problem... the command is called /msg.
If i rename it to e.g. /msgTest it works fine, so it seems you can't use /msg as command ?..
Quite strange..
Hello, i am currently having issue with something
basicly i am trying send a packet (? extends DefiendPacket) in bungeecord but when i try to send it using proxiedPlayer.unSafe().sendPacket(packed);
it throws error
io.netty.handler.codec.EncoderException: java.lang.IllegalArgumentException: Cannot get ID for packet class net.glomc.proxy.plugins.proxyplugin.packets.PositionPacket in phase GAME with direction TO_CLIENT
from what i understand it seems class isn't registered in the CODEC so how i can register it? since all classes for protocol in bungee are all private.
ah probably conflicting command
So BungeeCord already have a /msg command, as this is the only command right now 😄
you dont need to check name since you are already using getCommand()
ok i will try that
and how are you sure they are not registered?
thx it worked
Hey, I'm having problems connecting my plugin to a MySQL DataSource and I don't understand all the tutorials because somehow everything is never shown. Can someone help me step by step to connect my project with a MySQL datasource to my MySQL database?
PlayerItemDamageEvent works on armor?
?jd
?learnjava
Here are some links to get you started on learning Java:
- https://www.codecademy.com/learn/learn-java
- https://www.sololearn.com/learning/1068
- https://www.learnjavaonline.org/
- https://programmingbydoing.com/
- https://docs.oracle.com/javase/tutorial/java/index.html
The last one is the only official one, however some of those concepts assume that you already know a bit about programming.
Can i use spigot 1.17.1 plugins on 1.17?
That question for #help-server, and yes.
Thanks and sorry, next time i use #help-server 🙂
don’t see why not
it is
Can I detect when a plugin sends a message to a player?
Why?
I want to make a command to mute a plugin's messages
factions chat
I could modify it but i want to know what my options are :))
idk if you can
why does the enchantment not work
im using 1.8.8 paper server if makes any sense
uhh nvm just had to set the item there below the enchantments line...
Hello !
I'm trying to debug a plugin but i'm blocked.
I try to store data in an arraylist, but i have a java.lang.IndexOutOfBoundsException: Index: 0, Size: 0 error.
Nevertheless, when I try to print the two values stored in the arraylist, i have good values.
Can you help me ?
Thanks
Anyone know how to send fake chunk packets to players using ProtocolLib?
so any index will be required ?
Wdym by fake
Not real blocks. Just clientside blocks.
When you do myArrayList.add(something), it append the 'something' at the end of the array
lemme check the dock for you...
Cheers
ok. it's working.
what's difference between BlockCanBuildEvent and BlockPlaceEvent?
I checked javadocs but couldn't found useful thing
Nice. Good luck to you
merci
ItemStack cost = new ItemStack(Material.AMETHYST_SHARD);
cost.setAmount(8);
i.remove(cost);
player.updateInventory();```
This does NOT remove the items from the inventory unless the item stack has the exact right size. How can i remove a number of items from the inventory without knowing the inventory myself?
also why the hell does it WORK if i specify a number higher than the item can have?
*be stacked to
Wouldn’t it just be easier to modify the itemstack in their inventory and remove 8 from the count?
i would prefer not to inflate the code. The documentation makes it look like that would work
the thing is
i.contains(Material.AMETHYST_SHARD,<number here>)``` works even if the item stack is not the exact size
2nd problem is that its likely i need to remove more than one stack at some point
Is there any way to tell when a player loads a specific chunk or can see it?
theres seveeral remove methods in Inventory
check docs to find what you are looking for
probably removeItem will work for you
https://www.spigotmc.org/wiki/raw-slot-ids/ The brewing stand inventory slots are not vieuwed here, can somebody give me a picture of it?
it's probably 1-4 then counting up in your inventory
Found this: https://wiki.vg/Inventory#Brewing_stand
*0-3
It is 0 - 4 indeed
whats about debugging :D?
it will take maximum of 5 minutes
I am lazy 😄
and will give the best solutions
Yes true
only few minutes bro
and after that you can contribute spigot's wiki
How can I make mobs from spawners appear during the day with plugins?
keep track of spawners then tag em with a sceduler that spawns stuff
alternatively overwrite the spawning attempt event and make it always spawn, but i dont know if thats a thing
Hello. I thought of running a small Discord bot connection inside a plugin to help make some things a lot easier for us.
Is this a good working idea, or could/does that interfere with the server process somehow?
That’s literally what DiscordSRV does lol, #spigotcraft
Haha, well. Guess it's okay then. Thanks
Ye, it’s fine
How would I calculate the chunk data byte array for a chunk filled with just air?
Hey guys,
I am trying to make a plugin for 'Tag'
Can someone suggest a tutorial which I can watch to become better at making plugins since I am a beginner.
Thank you! 🙂
Maybe some tutorial you watched to become a pro
No no
the game of tag
where you tag other ppl
i have cracked mc so dunno
Learn Java then use the spigot guides
ill share a video 1 sec
Yeah no
i know java and spigot guides are boring
"guides are boring" then sit and take a look with wall
😅
Spigot guides are the best way, way better than shitty YouTube videos
I find reading very boring