#help-development
1 messages · Page 1617 of 1
Full stack trace on this pls.
Hey! Do you know any alternative to https://www.spigotmc.org/resources/api-bungeepacketlistenerapi.6155/ ?
Cant you just normally listen to packets using the Spigot API?
Hey there! I am trying to listen to packets using the Bungee API
I want to detect when the server send a resourcepack and cancel it if the player already has the pack
Cant you just use ProtocolLib for that?
Heyo, anyone knows the event for the block breaking process
afaik ProtocolLib is a spigot plugin @lost matrix
like before the block is broken
Thanks
Does not work
declaration: package: org.bukkit.event.block, class: BlockDamageEvent
yyyyy, I'm quite a beginner and I'm afraid I don't know what that means 😬
The error in your console is called stack trace
can you detect when a player jumps on a farmland?
PlayerInteractEvent -> Action.PHYSICAL
oh ok, and what should i do with it?
Copy it and send it in here
Anyone has an idea of how do I change mining speed of a block without haste?
Sending block damage packets and then destroying the block through code.
I think spigot now even has a method for that
This won't be enough
I had to also freeze the block mining to get it to work with oraxen
but that's cool because you can even make bedrock breakable that way
Btw @lost matrix , I found this: https://www.spigotmc.org/resources/protocolize-protocollib-for-bungeecord-waterfall-aegis.63778/
It should work I think
Ofc you need to intercept the actual damaging of the block by the player or else the damage will just be overwritten
No no
You must give slow digging effect too
because the mining is client side
this is it? (sorry if I gave it wrong, but this is the first time I encountered it)
[ERROR] /D:/Spigot/xDeveloper/src/main/java/pl/tuso/xdeveloper/NMSNametag.java:[3,43] cannot access net.minecraft.network.protocol.game.PacketPlayOutEntityMetadata
bad class file: C:\Users\Piotr\.m2\repository\org\spigotmc\spigot\1.17.1-R0.1-SNAPSHOT\spigot-1.17.1-R0.1-SNAPSHOT.jar(net/minecraft/network/protocol/game/PacketPlayOutEntityMetadata.class)
class file has wrong version 60.0, should be 52.0
Please remove or make sure it appears in the correct subdirectory of the classpath.```
uhhh idk
Wait. Is this a compile time error?
this didnt work tho
@EventHandler
public void onPlayerInteract(PlayerInteractEvent e){
Player player = e.getPlayer();
if (e.getAction().equals(Action.PHYSICAL)) {
if (e.useInteractedBlock().equals(Material.FARMLAND)){
player.sendMessage("farmland");
}
}
}
yup
yes
Configure your maven compiler plugin and make sure you have an updated jdk installed
<properties>
...
<java.version>16</java.version>
</properties>
<build>
<plugins>
...
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<source>${java.version}</source>
<target>${java.version}</target>
</configuration>
</plugin>
</plugins>
</build>
i found this in forums do you think it will be useful?
private void interceptPackets() {
protocolManager.addPacketListener(new PacketAdapter(instance, ListenerPriority.NORMAL, PacketType.Play.Client.BLOCK_DIG) {
@Override
public void onPacketReceiving(PacketEvent event) {
PacketContainer packet = event.getPacket();
EnumWrappers.PlayerDigType digType = packet.getPlayerDigTypes().getValues().get(0);
if(digType == EnumWrappers.PlayerDigType.START_DESTROY_BLOCK){
//Start task, call begin event,
} else if(digType == EnumWrappers.PlayerDigType.ABORT_DESTROY_BLOCK){
//Cancel task, save block break state.
} else if(digType == EnumWrappers.PlayerDigType.STOP_DESTROY_BLOCK){
//Cancel task, Remove block break state from map, call end event.
}
System.out.println("DigType: " + digType.name());
}
});
}```
Debug it with messages. See what gets fired. Also make sure to register the listener.
@grim ice what are you trying to do? 🙂
oh, i used Java 1.8 xD I apologize for the problems and thx for help
because the block is not breakable
does someone know what does this mean for a horse
How hard it is to tame
Taming depends on the horse's "temper". Horses begin with a temper of 0 out of 100. When a player first mounts the horse, a random taming threshold 0–99 is chosen. The horse becomes tame if the temper exceeds this threshold. Otherwise, the player is bucked off and the temper is increased by 5, to be compared against the threshold the next time the player mounts the horse.
is it possible to make entity.sheep.death just one sound variant instead of the more available sound variants
Only with a resource pack
The client decides what variant is chosen
I dont think so
No, only if a resource pack is used
JavaDocs
?jd
declaration: package: org.bukkit.entity, interface: HumanEntity
are you using the same version?
a player is a human entity
declaration: package: org.bukkit.entity, interface: HumanEntity
that makes sense, because it's not here
if you want to use it, use the 1.17.1 api
or use a different method
it actually doesn't need to be during an event. you could check at any time really. I don't see why that'd be practical though, just depends
It does.
You cant use an item without triggering an event
lol
I'm saying, you can still use the method outside of an event. It's literally a part of the interface
Saying otherwise is simply untrue
Yes that is true
But that's exactly why you can't with 1.16.5 api. The method isn't in that version
Oka
I wrote this method (using the rotation methods https://www.spigotmc.org/threads/166854/)
It's supposed to spawn a semicircle in front of the player where the player is looking. It works perfectly fine, I'm just having a hard time trying to rotate the circle while it's facing the player.
So currently this is player's POV if the code runs (lines are representing the particles)
------------
I want it to look like
\
\
\
\
public static void half(Player player) {
double radius = 3, secRadius = 4;
double every = Math.PI / 30;
Location loc = player.getLocation();
for (double rad = 0; rad <= Math.PI; rad += every) {
double x = radius * Math.cos(rad);
double y = secRadius * Math.sin(rad);
double rotateX = Math.toRadians(loc.getPitch() + 90);
double rotateY = Math.toRadians(-loc.getYaw());
Vector rotate = new Vector(x, y, 0);
rotateAroundX(rotate, rotateX);
rotateAroundY(rotate, rotateY);
Location finalLoc = loc.clone().add(rotate);
player.spawnParticle(Particle.FLAME, finalLoc, 1, 0, 0, 0, 0);
}
}
can EntityItem startRiding player? (CraftPlayer)
item.startRiding(((CraftPlayer) p).getHandle());
PacketPlayOutMount itemMount = new PacketPlayOutMount(item);```because it doesn't work
not sure about mounting but you can attach it to the player
xD old project, I already got what I wanted, but I am checking different solutions
so, how?
How can I make when interacting with an entity it rotate and look at me?
um
if i used public static ItemStack to access the itemstack from a different class is that static abuse
Depends who you ask. I personally don't think so but others might.
public static ItemStack getBedrockPick(){
ItemStack item = new ItemStack(Material.STONE);
return item;
}
its longer than that but thats an example
Why not just
public static ItemStack bedrockPick = new ItemStack(Material.STONE);
does anyone have an idea how i could possibly make a buy sign that gives you a rank and some permissions with it
example
[Buy]
"rank name"
"rank prefix"
{cost of rank}
Maybe use a player interact event, check if it's a sign, then get sign text and parse into what you need?
Hello, i've a problem, i create arrow, but i can't collect the shooter with #getShooter
world.spawnArrow(player.getEyeLocation(), player.getEyeLocation().getDirection(), 3, 0);
so how can i collect shooter or add shooter to my arrow ? thx you c: (sry for my superb enslish)
If you spawn the arrow with the player, then is that player not the shooter?
No, you have to use the returned Arrow Entity and setShooter on it
You are spawning it, not shooting it so no shooter unless you set it
@EventHandler
public void onProjectileLaunch(final ProjectileLaunchEvent event) {
final Projectile proj = event.getEntity();
final ProjectileSource entity = proj.getShooter();
if(entity instanceof Player) {
if(Commands.Red.getPlayers().contains(entity))
proj.setCustomName("red");
if(Commands.Blue.getPlayers().contains(entity))
proj.setCustomName("blue");
Bukkit.broadcastMessage("t'es un joueur");
} else {
Bukkit.broadcastMessage("t'es pas un joueur");
}
}
i use it for know if shooter was player, but don't work with my arrow spawned but with bow that work !
I just told you why
^
how can i make this so ?
How can I make when interacting with an entity it rotate and look at me?
Wdym by interacting?
PlayerInteractAtEntityEvent
then teleport the entity to the opposite yaw & rotation of the player’s eye location
@eternal oxide thank you for what you are doing!
every time I go to this channel I see you helping people
I set the shooter like this
world.spawnArrow(player.getEyeLocation(), player.getEyeLocation().getDirection(), 3, 0).setShooter(player);
but don't work too 😦
Who can help me ? :c
that didn't work with my spawned arrow, but with ussless bow that work
@EventHandler
public void onProjectileLaunch(final ProjectileLaunchEvent event) {
final Projectile proj = event.getEntity();
final ProjectileSource entity = proj.getShooter();
if(entity instanceof Player) {
if(Commands.Red.getPlayers().contains(entity))
proj.setCustomName("red");
if(Commands.Blue.getPlayers().contains(entity))
proj.setCustomName("blue");
Bukkit.broadcastMessage("u are a player");
} else {
Bukkit.broadcastMessage("u are not a player");
}
}
no one ? 😦
Because that event isn't fired when you spawn an arrow
You need to call it yourself
when i show arrow with bow i have broadcast (u are a player)
but with my spawned arrow (u are not) so this event was called, but idk why that didn't work
yea sure !
Hey guys! Somehow this returns null: ```java
public static Inventory perkinv() {
Inventory inv = Bukkit.createInventory(null, 6*9, "§c§lPerks");
ItemStack ph = new ItemStack(Material.BLACK_STAINED_GLASS_PANE);
ItemMeta ph_meta = ph.getItemMeta();
ph_meta.setDisplayName("§8");
ph.setItemMeta(ph_meta);
inv.setItem(0, ph);
inv.setItem(1, ph);
inv.setItem(2, ph);
inv.setItem(3, ph);
inv.setItem(4, ph);
inv.setItem(5, ph);
inv.setItem(6, ph);
inv.setItem(7, ph);
inv.setItem(8, ph);
inv.setItem(9, ph);
inv.setItem(10, ph);
return inv;
}```
1.17.1 btw
You sure
Send the error
You should probably just use Player#launchProjectile if you're making the player shoot something
It is working
@vivid zodiac you need to lunch projectile not spawn arrow
there method called player#lunchProjectile
Okay thx i let's try it ! 😄
u can't detect if a player opens their own inventory in modern mc versions right?
no

that work perfectly thx y
hey i have a little issue with maven stuff
im so sorry
i keep googling just to get like, wikihow-type tutorials ._.
idk what im doing wrong im so sorry
i feel bad because this is probably a super easy fix
You have yet to tell us what your problem is
What IDE?
eclipse
that wont mess anything up?
it just clears any compiled cache
Maven repository says the newest version of JDA is 2.3.0_247
(JDA github)
ok, in their own repo. Have you added their repo?
one sec, theres a clear tick box you need to do...
owo?
have to open my IDE to find it
ah
i might just remove the dependcy/repo for JDA and add itw ith the "add dependency"
Right click your project in the Project Explorer, window. Select Maven -> Update Project... tick the box - force update of snapshots/releases
still getting a missing artifact error
did it update dependncies? you shoudl see an update bar bottom right
did you tick the box to force update?
yep
No clue then. That should work
im just gonna add it with the "Add dependecyn"
do i need to add the JDA jar somewhere??
no, thats what maven is for
thats what i thought
oh it worked now
i had the wrong version
_277
¯_(ツ)_/¯
alright, it now works, now im just not sure why the classes arent loadind
Hello, so my bungeecord's player count grows infinitely
Basically getOnlinePlayers().size() never drops, but rises when a player that haven't joined in a session joins
And if they leave, they're not removed from the list
How can I fix that?
Also, when I try to kick the player, it says "successfully kicked", but I can do that forever
Elements just won't remove from the collection
I haven't touched any plugins for like few days, and it never happened till now
can some body tell me is it possible to grab thread from AsyncPlayerPreLoginEvent and merged with my other thread
How are you using getOnlinePlayers? Can you show some code.
is it possible to create an explosive which knockback entites
soooo
the JDA works but like
idk why the bot doesnt enable???
says the classs doesnt exist?
but i shaded in right im 99% sure
if the people in gg/jda were any help
not shaded
Location l;
for (Entity e : l.getNearbyEntities()) {
e.setVelocity(e.getVelocity().add(3, 3, 3));
}
give it a compile scope
The people in that cord are just annoying
ya
check in pom
thats in the dependency, <scope>compile</scope>?
yes
so i dont need the maven-shade-plugin ?
shade is automatic if you don;t specify the shade plugin
LOL okay
@crimson scarab you can also use World#createExplosion
for an actual explosion
declaration: package: org.bukkit, interface: World
still having the issue
the only downside to this is that it may hurt entities
i'll export one more time lol
open your jar and see if its in there
Can’t you just use the damage event?
in the IDE?
how would you know if it were your explosion?
You don;t need to shade if you are using spigot 1.17]
interesting
use teh libraries entry in plugin.yml
?paste
https://paste.md-5.net/olahamajex.xml here's my pom,
idk if that would work though
becauseee
i'll get some invalid import errors
Is that the new thing that downloads dependencies on startup?
yes
I should learn how that works it sounds cool
idk what im doing wrong
you prob could use EntityDamageByEntityEvent
huh?
Hello, I making a minigame, so I need a countdown for death(5 sec). I try scheduleSyncRepeatingTask, but when many players it's confused and broke. So how can I make a countdown(every second send title)?
an explosion isnt an entity
open your jar and see if it included jda
i dont see JDA anywher
what folders do you see?
runTaskTimer() every with a 20 tick cycle, cancel after 100 ticks.
Why are you exporting and not building with maven?
oh is that a thing
I swear an explosion counts as entity
It doesn't, but you might be able to set the Explosion source to a TNTPrimed entity & use that to detect if the explosion was yours.
i dont see like "Build with Maven" ora nything like that
:(
I’m not at my pc smh
its still no way to know if its your plugin
Right click your pom, Run as
maven build
Goals should be clean pacakage
then look in your target folder
same error
and i still dont see JDA.. im now completely confused
i get this error when i first build
did you get the jar from your target folder?
i got the jar from eclipse-workspace, i dont see a target folder
there is not
if it built, then there is
if it said build success there will be a jar
"build failure"
read teh log and see why it failed
100 errors
does anybody know how to teleport 10 blocks forward where somebody is facin
everything errored?
https://paste.md-5.net/savoqavuhi.coffeescript is the Console tab after i built with the goal "clean package"
player.getlocation().add(player.getLocation().getDirection().multiply(10))
you have no spigot repo
what the fuck
player.setVelocity
don't add to player.getLocation
scpoe provided
get the location, add the multiplied vector, and teleport the player to that location
yeye if that's what you want, sure
and i can delete "Referenced libraries" now?
yes
all depends should be from maven. No imports
cool, im not sure why but for some reason Bukkit stringutils doesnt work with maven?
yes it does
odd
if you added the repo and the dependency
yeah i added both
i can just make my own isBlank i guess
not too worried about that
are you depend on spigot or spigot-api?
hey my bad but multiplying directino doesn't seem to work
lemme try debug first though
spigot-api
don;t use teh bukkit libs, apache commons is packaed with spigot
yeah, i think it aut oimported im prettty sure i just googled like "spigot see if string is blank"
i just made my own isBlank boolean, so /shrug
oh 😳
Hey guys, is it possible to play the waking up animation to a player (who isn't actually waking up)?
as in the slight fade effect
Aha, and how would I go about using packets 😛
You avoid them unless there is no alternative, otherwise usually ProtocolLib
in resources folder
theres no resources folder, unless you mean src
nvm fixed it
not srvc
in your project folder at teh same level as src, add a folder called resources
I think
right click teh folder and set use a source folder
under build path I think
else its in the wrong place. It may need to go under src/main
I use a custom build path setup so mine is different
weird haha, i've always just had it in the project folder
maven has a default place to look
jar does not contain plugin.yml
its in the same place as src
probabl yneeds to go under src/main/resources
ahhhhh
maybe if someone else could confirm where the plugin.yml goes
because i've seen tutorials where they havei ti n the project folder
yeah, thats not maven
it 100% sits in your resources folder
you just need to right place for your folder
I use custom paths so I've no idea where the default location of resources is
is it really in my build path yikes
Why can't you go lower?
so it should go into my main class package?
what stops at 1.12
How can I check if if an entity with a certain scoreboard tag exists?
in a certain world
how to teleport on top of a block
idk what im doing wrong, "Invalid plugin.yml" and "Jar does not contain plugin.yml", im seriously confused and idk what to do
ok how does that help me
or provide any assistance/advice
Since you're used to commands in datapacks and such I think you want something like this https://hub.spigotmc.org/javadocs/spigot/org/bukkit/Bukkit.html#selectEntities(org.bukkit.command.CommandSender,java.lang.String)
It will query entities like the selectors do in a command. CommandSender being the sender, you can probably use the console and string being selector.
I'm not sure if this is any faster or slower for that matter than looping entities and checking
declaration: package: org.bukkit, class: Bukkit
are you done thinking its been two whole minutes
onEnable
because thats
thats hwen the plugin enables
actually pretty sure when it loads
who know how can i remove this ? https://prnt.sc/1ishj9e
You can't
ok you're not helping me im sorry, everything in plugin.yml is correct
anybody know to to check if a location is beneatth the ground
You can use https://hub.spigotmc.org/javadocs/spigot/org/bukkit/World.html#getHighestBlockAt(org.bukkit.Location) to teleport someone above ground and on top of everything
declaration: package: org.bukkit, interface: World
ah no its like i've got a sword that teleports 10 blocks wherever your facing
so i need to make sure it won't send the user into teh ground
Oh like in a block
Atleast they're trying to help
i understand that, but my issue should be semi-clear and understandable
Just get the block at the location and check the type
Just looking at your setup on the surface it looks like the location you've specified for your plugin.yml is a invalid path
how should one fix that?
Since the dir you've put it in is a sub dir of the main path which it does not belong
ahh
and check line of sight
i saw an <includes>plugin.yml</includes> somewhere... do i add that somewhere
There is a rayTrace method you can use to find blocks in the way
declaration: package: org.bukkit, interface: World
Then use the result of that to teleport
put the resources folder where it was, next to your src folder, then add to your pom ```xml
<build>
<defaultGoal>clean package</defaultGoal>
<sourceDirectory>src</sourceDirectory>
<resources>
<!-- Include all resources -->
<resource>
<directory>resources</directory>
<filtering>true</filtering>
<includes>
<include>.yml</include>
<include>.txt</include>
<include>.json</include>
<include>.properties</include>
</includes>
</resource>
</resources>
</build>```
thats what I use
RayTraceResult (the location of what it hit)
okay so plugin.yml good place now, plugin loads...
same JDA ERROR
now look in the jar adn see if it includes jda
it doesnt
Did you add the shade plugin?
everyone told me to that, then everyone told me not to
shade is default in eclipse with the correct scope
yeah i have scope compile..
if you totaly remove teh scope line it shoudl be forced to shade
should i move it above everything
Since that doesn't work add the shade plugin
no, just delete teh scope line from it
ok
if that doesn;t work, we'll add shade plugin
It won't
this is Eclipse, it doesn;t require teh shade plugin to be defined
Eclipse shouldn't mess with how Maven works
no jar
?paste the log so we can see if it attempted to shade
Now let's add the shade plugin
yep
yes
It won't shade without it. Idk where you got that from ElgarL
"dont be a pussy"
i cbb to join the JDA discord again because those guys are annoying
so ima just google
Yall are still trying to fix this
yes
its been like 2 hours
add under plugins a new <plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.2.4</version>```
version will probably be old
and xml <executions> <execution> <phase>package</phase> <goals> <goal>shade</goal> </goals> </execution> </executions>
to JDA?
ok, then add it using the maven menue
right click pom, maven - add plugin
type in teh box shade
this is probably a really dumb question, but how do i use the specialsource.jar in for a 1.17 plugin in eclipse? i haven't messed with nms before so i haven't had any reason to use it 😅 could anyone help me out? thanks!!!!
Are you using Maven?
no - should i be using that instead?
Not instead with
I recommend looking up some tutorials for it. It's highly recommended for dealing with things such as specialsource
Yeah but maven can be easier at times
🤷♂️
ok! that helps a lot. thank you!!! :D
how do you check if a player is op'ed
any JDA nerds here? any idea why jda.getGuildById(long) is null
the long is a guild id
the text channel is also null
#isOp
its the logger which also prints your stuff into the console
tyty
Possibly-null Guild with matching id.
https://ci.dv8tion.net/job/JDA/javadoc/net/dv8tion/jda/api/JDA.html#getGuildById(long)
Wrong id?
right ID
odd
either way the channel is null aswell
im not sure why
i guess it also returns "Possibly-null"
any idea how to make it not null???
Have you tried other channels
True
jda is also set
debug https://ci.dv8tion.net/job/JDA/javadoc/net/dv8tion/jda/api/JDA.html#getGuilds() and check the output
Is there a way to wipe out a whole chunk in one go?
aside from making a schematic of a chunk and using world edit to paste it
I'm currently using
public static void clearChunkOldWay(World world, Location loc1, Location loc2){
IBlockData air = fromMaterial(Material.AIR);
int topBlockX = (Math.max(loc1.getBlockX(), loc2.getBlockX()));
int bottomBlockX = (Math.min(loc1.getBlockX(), loc2.getBlockX()));
int topBlockY = (Math.max(loc1.getBlockY(), loc2.getBlockY()));
int bottomBlockY = (Math.min(loc1.getBlockY(), loc2.getBlockY()));
int topBlockZ = (Math.max(loc1.getBlockZ(), loc2.getBlockZ()));
int bottomBlockZ = (Math.min(loc1.getBlockZ(), loc2.getBlockZ()));
for(int x = bottomBlockX; x <= topBlockX; x++) {
for(int z = bottomBlockZ; z <= topBlockZ; z++) {
for(int y = bottomBlockY; y <= topBlockY; y++) {
if (!loc1.getWorld().getBlockAt(x, y, z).getType().equals(Material.AIR)) {
setBlock(world, loc1.getWorld().getBlockAt(x, y, z).getLocation(), air);
}
}
}
}
}
it returns nothing
not even a list?
nope
so you've done something wrong
Are you running it on its own or in a plugin
ok
?paste
If it is a plugin, make sure to restart the whole server. A reload causes issues
Maybe try restarting the whole bot?
why do you have the token in your class & where do you insert this method?
my main class
wow
idk why the token's in the class tbh, i was just following some tutorial
the bot starts up though?
is there a suggestion to improve this?
listen for the readyevent
and put your guild check in there
to make sure that the bot is ready when getting the guilds
You should make the user specify it in a configuration file instead
Or just in general
Don’t hard code values like that
bump
I can't think of anything sry, is it causing a lot of lag or something?
that and also taking a long time
You could try putting it on a separate thread, tho that might break stuff
Rip. theres no method to remove whole chunk...
You could try finding the file for the chunk data and deleting it
hmm so then my only good option would be to use the FAWE API to paste a blank schematic?
Thats pretty easy..
Might be hard but could work
That could lead to some issue though?
Not rly unless it's loaded
It would be loaded...
Trying to kill players?
No; they're flying above the chunk
And then you want to remove it? Kinda weird but ok
Ig fawe and your old method are the only ways then
Another question regarding FAWE/WE;
How come scheduling this on another thread other than main thru the scheduler causes it to do nothing?
public static void clearCubicArea(Location loc1, Location loc2){
try (EditSession editSession = com.sk89q.worldedit.WorldEdit.getInstance().getEditSessionFactory().getEditSession(new BukkitWorld(loc1.getWorld()), -1)) {
CuboidRegion targetRG = new CuboidRegion(new BukkitWorld(loc1.getWorld()), BlockVector3.at(loc1.getX() + 1, loc1.getY()-1, loc1.getZ() + 1), BlockVector3.at(loc2.getX(), loc2.getY(), loc2.getZ()));
Mask mask = new ExistingBlockMask(editSession);
editSession.setBlocks((Region) targetRG, BlockTypes.AIR.getDefaultState());
editSession.flushQueue();
}
}
Sync or async thread? If async maybe it needs main thread, since blocks cant be placed async
i might just make a "Bot.java" class
should i do that intsead
Idk tbh im guessing at this point, maybe they are using something else for schematic
I guess what I'll do is make a schematic of a cleared chunk and just paste it at the corner of the chunk every time
Or make it set air instead of taking chunk schematic and keeping it in ram, that is if you can, dont remember much of fawe api
hey kennt jemand ein Plugin für ein Händler wo man Sachen verkaufen und kaufen kann ?
since fawe uses NMS blocks & their own interfaces of blocks
#help-server and english only
@valid crag I think having the map is just messing everything up
or at least its confusing me
Because when I'm saving it I have to save every single one and not just the one they got a cooldown on
@hybrid spoke i used the ReadyEvent, still nothin
Yes but is not possible to just save the one they have a cooldown on?
instead of all of them
but don't I need to do data.cooldownMap.get("cooldown") to get the cooldown?
unless I loop through it
what do you mea nthere is no cooldown?
mhm
but if I'm saving don't I need to do data.cooldownMap.get("cooldown")
ok
I want to remove scoreboard packets of BungeeCord, seems to work good but plugins of spigot doesn't handle good them (Any solution?)
why tho
So heavy, im trying to do it a bit more ligthweitgh
Handles best more players.
I suppose then just fork bungeecord, delete the class and fix all the errors you get. But it shouldn't use it if you dont use it and make no difference
Well, isn't really an Bungee issue mostly like a spigot (PlayerQuitEvent), the scoreboard doesn't get fired when changes from server.
Increases really preformance.
is there any way to get a player head and it not update to the new plays skin
if that makes sense
like if i change my head to a certain texture
is there a way to get that head and for it to never cahnge
i think tihs da right chanol
how do i make the player leap in a direction they are facung
how would i put a package inside a package? in eclipse
right click the package and hit add package
set velocity or something?
pretty sure theres a codedred tutorial for it
spoonfeeding is looked down upon
im too lazy to check, Block#isPassable() will return true with water?
do you really mean leap or just teleport?
probably leap, u cant really misunderstand leap and tp
they are totally different
that doesnt do it because it jsut places under the package
He was asking earlier how to make a player teleport 10 blocks forward
which is why I ask
You must have a file in the first package
got it working
anyway to make sure the players head is above a certain angle
i've tried checking pitch
o
If you are attempting to ensure they always "leap", so forwards and upwards you need to calculate the pitch yourself.
getLocation(), set pitch to -45, then getDirection().
Hello i'm asking for how to keep the diamond_sword item in player inventory on death
my code:
for (ItemStack item : e.getDrops()) {
if (item.getType().equals(Material.DIAMOND_SWORD)) {
e.getDrops().remove(item);
}```
but that not working
can some one help please?
compare a Material enum with ==
also use an iterator, you will throw an exception removing from a Collection you are looping over
^^^ or lambda e.getDrops().removeIf(item -> item.getType() == Material.DIAMOND_SWORD)
Oh yeap my bad lol Was thinking setting the list
this one
Show us your code
okay
soo what the code does
is to check and see if the dropped item is a diamond sword
and if it is
it removes it
not keep it
?
@EventHandler
public void onD(PlayerDeathEvent e) {
Player player = (Player) e.getEntity();
Player killer = (Player) e.getEntity().getKiller();
e.getDrops().removeIf(item -> item.getType() == Material.DIAMOND_SWORD);
if (killer instanceof Player) {
Main.getInstance().getAPI().addKills(killer, 1);
Main.getInstance().getAPI().addDeath(player, 1);
}
}```
i just want to keep diamond sword when player death @digital plinth
and remove other items
!=
well 1m
no not working 😦
e.getDrops().removeIf(item -> item.getType() != Material.DIAMOND_AXE);```
are you able to affect the drops at all?
Idk maybe it just provides a view
i have tried the axe
did you register the Listener?
Remove the items through the players inventory maybe
yes ofc
Many don;t
for (ItemStack stack : e.getEntity().getInventory().getStorageContents()) {
//Do what has to be done
}
Well you might want a fori loop
Uh my bad
it's ok
ItemStack contents = e.getEntity().getInventory().getStorageContents();
for (int a = 0; a < contents.size;a++) {
// to remove do this;
e.getEntity().getInventory().setItem(i,null);
}
Jesus I won’t spoonfeed again sorry
Debug.... also its e.getDrops() already removed the item from the inventory?
test with getDrops().clear() to see if it can affect the drops.
yes all items dropped
then it seems getDrops is now only a clone. It no longer affects dropped items
yes it is
you will have to modify it in teh drop event
PlayerDropItemEvent, test if the player is dead
i think PlayerDropItemEvent is for when player dropping item by clicking "Q"
it should be for any time they drop
what if i did keepinventory and clear all items except the sword?
nope
teh JD says setting keep inventory will nto stop drops
setKeepInventory
public void setKeepInventory(boolean keepInventory)
Sets if the Player keeps inventory on death.
This doesn't prevent the items from dropping. getDrops().clear() should be used stop the items from dropping.
Parameters:
keepInventory - True to keep the inventory
okay i'll try playerdropitemevent
However getDrops() now seems to be a clone so I'm guessing they moved the functionality to the drop event
@EventHandler
public void onDrop(PlayerDropItemEvent e) {
Player p = e.getPlayer();
if (p.isDead()) {
e.setCancelled(true);
}
}```
i'll test
Still trying to do this. if anyone knows
#help-development message
I didn't understand your goal
What is yoru code currently doing that it should not?
The particles need to rotated while facing the player, let's say 45 degrees like I showed in the POV
is there an event that is called when an entity despawns?
what is your current code doing?
it is spawning the particles in the player's direction, but I don't know how to rotate them relative to the player's direction.
This is how you see the particles if that code runs.
--------------
It's a semicircle from another angle, but that's just the POV.
I don;t understand a line of dashes
Those are representing the particles
ok
ok, so your current code works fine, but it also included pitch, is it supposed to?
That's correct. I tried adding the degrees direction to the rotateX double, but that obviously doesn't work as it's a constant number. It's not relative to the player's direction.
yes, but your rotateAroundX and Y is not Bukkits
Oh that doesn't matter yeah, they're the same
?paste
This works fine https://paste.md-5.net/jebaduduyi.cpp
it is always in front of the player
Alright, yes it does, but can you screenshot what you're seeing?
You can join palmergames.com:1 to see for yourself
Sorry I'm not really in the situation to do that
Can't you just take a quick screenshot?
hey hey, any idea why my holograms & npcs arent deleting? (custom stuff, sucks but it gets the job done)
i have a boolean just to make life a little easier
returns true for NPCs and holograms
public boolean isNpc(Entity e){
Bukkit.getServer().broadcastMessage("" + (e.isCustomNameVisible() && e.getCustomName() != null));
return (e.isCustomNameVisible() && e.getCustomName() != null);
}
and so obviously that works
(debug message for broadcast ignore that)
however, when i try to loop the entities of a world on the world load event,,,, nothing happens
i've also tried the ServerLoadEvent, where i actually spawn the NPCs and holograms
so idrk what's causing the issue..
https://imgur.com/a/hzkMZZa
The red line is what I want it to look like
Remember the dashes
So the two points of the circle should still face the player
do you mean a straight line and not an arc?
No that's just from the player's POV :/
I didn't draw the semicircles bulge because that's supposed to be outward where the player is looking
Because you'll see a line if you change loc to player.getEyeLocation()
Then I have no idea what you are trying to achieve. That red line means nothing to me.
up one side but not the other?
Ok let's just think about it like this
Rotate the circle in any direction in any degrees relative to the player's direction.
What I mean by "relative to the player's direction" is that when you look in different directions, the circle should look the same.
I really can't explain it any better than this
I don;t understand. It does move with the player and renders depending on teh players direction
so not relative to the ground, but slanted?
No, rotate it relatively.
Yeah, I'm not understanding at all
bro
the player is always perpendicular to the ground
Ignore the ground. Make the circle look like it's coming from up to down, instead of left and right
You should understand that, like please lol
No, your description is terrible 😦
So if I print data.cooldownMap in the current method it's in it becomes null but if I do it when a player joins it's not null so im wondering why is this happening. When the player joins im adding the player data into the map.
I'm guessing English isn't your native lang?
Yes I'm English, with over 40 years of programming experience. Your description is simply terrible
YOu say relative to teh player. teh player is upright so you only have pitch and yaw of the head
you currently have a half circle relative to teh players direction.
do you mean you want to rotate teh Z axis?
Yes, I do, but it's currently in the player's yaw direction, make it look like it's in the pitch direction.
Which basically means, not right and left, but up and down
I could simply just switch the x, y myself, but that's not really what I want.
I can't change the code for every single angle that I want, can I
So you want it to come from under his feet and curve up over his head?
yes exactly!!
use some math stuff
finally
You could have just said that 🙂
bump
Also the player isn't null
oh
fixed it
I'm sorry, are you still working on this? How did it go?
Still looking
Alright, I really appreciate it ^^
@smoky finch so you just want to tilt the semicircle up on the left side basically?
Exactly, I just want to rotate it in the yaw direction
Well you have the start and end points. You can get a slope from that and apply that slope on each particle step, adding to the y coordinate.
The end point would just be how high you wanted it to tilt basically.
Surely there should be a simpler way using the rotation methods?
how would I store quest data via SQL?
Who know how can i lock slot armor ?
InventoryClickEvent
@smoky finch is that what you wanted ^?
Stick curse of binding on it :p
and if he's clicking on slot 38 i return ?
its like a return ?
what?
i don't know what do you mean by Cancelled event
?paste send your code here
@valid crag I got everything setup to my liking and got it working 🥳
I just have code to add armor, but no to lock slots
so create a InventoryClickEvent
omg you did it.
Wait did you just add the degrees to the yaw???
That's all it took?
and rotate on Z
oh
Oh I see, I tried adding the number directly to the yaw before and it was giving weird results. So I just had to rotate the Z instead
I still don't get the logic behind rotating Z instead of X but I'm gonna figure it out
Thanks a lot again. Sorry if my explanation was too confusing
fixed naming in edit
@vivid zodiac https://paste.lucko.me/mVbA4nMwxH
Oh okayy, thx you
does anyone know how to save quest data via sql?
that didnt work xd
quests like things to hunt for?
Really depends on how your quests are structured
they're just simple
quests:
quest1:
tasks:
- "mine:5:DIAMOND_ORE"
- "kill:5:SHEEP"
rewards:
- "give %player% diamond 1"
just simple like that
Oh if you have simple String serialisation like that then its quite easy.
yes but I also need to save progress
If the progress is always deterministic and quantifiable then you can just modify your current model like this for example:
quests:
quest1:
tasks:
- "mine:2/5:DIAMOND_ORE"
- "kill:1/5:SHEEP"
rewards:
- "give %player% diamond 1"
okay its just beacause u forgot breaks x)
but ty 😄
hmm and how would I go about saving that via sql? like what would the table look like?
As you have lists you probably need to be a bit tricky. Unless you want to properly construct relational data. Then you would need multiple tables
It could be as simple as:
| quest_name | owner | tasks | rewards |
well I dont need to save all that
the quests will be set via a config file
I just need to save task data via sql
So the quests are static and you only want to save the progress?
I feel like quests may fit better with Nosql
Ah. Then you need a way to identify a single task by assigning it a unique identifier.
tasks:
killPigTask: "kill:5:PIG"
mineDiaTask: "mine:5:DIAMOND_ORE"
quests:
coolQuest:
tasks:
- killPigTask
- mineDiaTask
rewards:
- "give %player% diamond 1"
This way you can save player specific progress with
| quest_id | user_id | progress |
so what would the progress column look like?
"killPigTask:2#mineDiaTask:1" for this example.
But this also depends on your data model...
so could i elimate the seperate tasks and do the column to be "kill:1/5:PIG#mine:5:DIAMOND_ORE"?
because there is like 70 quests and I dont want the client to have to go back and forth in the config if i dont have to yk
This is also possible:
| quest_id | task_id | user_id | progress |
| coolQuest |killPigTask| some_id | 3 |
| coolQuest |mineDiaTask| some_id | 1 |
sent in dms
np
Im doing a for loop through a List<String> how do i get the index of it in the for loop?
.size?
the index of the item in the for loop?
oh
You can;t get the index from the entry itself
By not using a for each syntax but by using an index iteration
for(int index = 0; index < list.size(); index++){...}
yeah okay ty
And dont use i or e or p. Single letter variables are dirty trash regarding clean code.
^
Its still a single letter...
The names should be meaningful ofc -.-
also they should be descriptive and self documenting
Ah i see

anyone here familiar with hikari?
Its pretty straight forward
it's not inputting it into the database and it's not giving any errors
Hikari is just providing a bunch of connections and shouldnt have an impact on your queries.
Show some code pls.
wait i think i found it out
I'm using a %prefix% variable for table prefixes and i didnt set it...
yup
@EventHandler
public void bounce(PlayerMoveEvent e) {
//if player enters region (already got the code for this)
Vector velocity = e.getFrom().toVector().subtract(e.getTo().toVector());
e.getPlayer().setVelocity(velocity);
}
}
this causes the player to glitch terribly, does anyone know of a solution to bounce the player back?
I mean setting their velocity is going to trigger the event again
And you basically end up setting their velocity to opposite directions over and over
Toggle entry and exit. Dont apply anything if the user already entered the region.
If there isn't value that is equal to what ever I put into for REPLACE INTO will a new value be made still?
https://www.javatpoint.com/mysql-upsert
I think what you want is UPSERT
ah yes I think so
It can be used in this context: If exists -> update, else -> insert
On duplicate key update is still mean
What do you mean by "mean"?
by using what data type?
It increments the primary key even if it replaces, which isn’t a big deal but still
It bothers me
Huh didnt know that
Idk do your regions have a UUID?
no, just checking distanceSquared of a certain location to tell if they're in proximity or not
Maybe just maintain a transient Set<UUID> inside your region where you track what user entered already. This way you can also get every user within a region really quick.
Eh...
Do you have multiple "regions"?
yea ig
Whatever you use: You need a toggle system and a filter in your event.
Maybe even create custom events:
UserEntersRegionEvent
UserExitsRegionEvent
And listen to them.
is there any sort of alternative solution like to put the knockback velo into cooldown after doing it once, so that it verifies the player has been fully knocked back?
Thats also possible.
Just a Map<UUID, Long> to check the last timestamp he was knocked back at.
But thats a bit hacky
But it should work
playerData is null
was about to test that
If this is the last stack
ugh god damn it my map is empty
IM SO STUPID
I have SELECT * FROM kitCooldown WHERE UUID = ? when there is no data for that user
oh wait
no im not
public class BounceListener implements Listener {
Map<UUID, Long> lastKnocked = new HashMap<>();
@EventHandler
public void bounce(PlayerMoveEvent e) {
if (lastKnocked.containsKey(e.getPlayer().getUniqueId())) {
if (Instant.now().toEpochMilli() - lastKnocked.get(e.getPlayer().getUniqueId()) < 1000) {
return;
}
}
if (Core.region.equals("blacklisted")) {
Vector direction = e.getPlayer().getLocation().getDirection();
e.getPlayer().setVelocity(direction.setY(-0.5).multiply(-2));
lastKnocked.put(e.getPlayer().getUniqueId(), Instant.now().toEpochMilli());
}
}
}
got this down, probably needs some optimizations but issue with the velo, unless the player is jumping it's just gonna knock them sorta back into the ground moving them probably 4/10th of a block fixed, but lmk if it needs any changes
If you do this and the player runs in backwards he is thrown into the region
that's true
Get his velocity and invert it instead of his looking direction
Looking for a plugin dev who's worked with prisons before. Willing to pay. Pm me
?services
If you wish to request or offer development/art/building/administration services, please do so at https://www.spigotmc.org/forums/services-recruitment-v2.54/
Thank you
Vector pVelo = e.getPlayer().getVelocity().multiply(-1);
e.getPlayer().setVelocity(pVelo.setY(-0.45).multiply(-1.5));
doesn't propel me in the opposite direction, just launches me up
.setY(-0.45) ?
you multiply by -1 then by -1.5, plus add Y
Vector pVelo = e.getPlayer().getVelocity().multiply(-2).add(0, 0.4, 0);
This should launch him back and up a bit.
e.getPlayer().setVelocity(pVelo);
What did I do wrong sql INSERT INTO kitCooldown (UUID, Time, Cooldown) VALUES (?, ?, ?) ON DUPLICATED KEY UPDATE UUID = ?, Time = ?, Cooldown = ? ```
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'DUPLICATED KEY UPDATE UUID = '631b2936-7672-474d-9b4f-3366504065f', Time = 1628' at line 1
the 0, 0.4, 0 should be a vector right?
otherwise the ide gives an error
Oh yeah. Only location has that method
oh man java.sql.SQLException: Parameter index out of range (6 > number of parameters, which is 5).
yes i know
Not enough placeholders ?
"6 is bigger than number of parameters, which is 5"
So to few placeholders
Wait
Might be too many
Eh im tired
...
.
are you kidding me > [04:31:43 WARN]: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'DUPLICATED KEY UPDATE UUID = '6312936-7672-474d-9b4f-3366504065f0', Cooldown = '' at line 1
final BaseComponent[] components = TextComponent.fromLegacyText("Hi");
Also: You are using the wrong package. java.awt is not what you want.
i don't want final doe, i wanna add click and hover
final has nothing to do with that
also ur code doesn't work
It does. You are probably still using the wrong package
wdym wrong package
is there another meaning to package apart from folders for classes?
am i missing something here?
You imported java.awt.TextComponent
And that is used for GUIs in plain Java. Desktop applications so to speak. It has nothing to do with spigot or minecraft.
do i need bungee for this
No. The package you want is on the spigot classpath
Copy pasting large/small region with custom Extension File
Hello! I want to copy-paste large/small region area with my custom extension file.
in google, they saying just use worldedit and they don't giving solution. (without worldedit)
I'd appreciate it if you could explain it with me. (not only code feed)
uhh thanks you but i dont want use worldeidt
Ah i see. Then its quite complicated depending if you want to support the full NBT spectrum.
It's time for a giant adventure.
hey all
i've made a custom set of armor
and i'm just wondering how to implement a full set bonus
giving people in rain or water potion effects
i'd check for armor equip / unequip
then set variables for when they have it, and then give them stuff when they have everything
Check for armor equip / unequip. You will also need a runnable that constantly applies the potion effects.
alright
btw i still need help
So does ON DUPLICATE KEY UPDATE update only ones with primary keys?
whats your issue buenny
trying to do hoverable and clickable messages
New to Spigot, how do I execute a command from the plugin? Like, I want to shift, and have it execute a command, but not entirely sure how to do the execute a command part
This lets the console dispatch a command:
Bukkit.dispatchCommand(Bukkit.getConsoleSender(), "some command");
Instead of the ConsoleCommandSender you can also provide a player and force him to dispatch a command.
got an issue here two identical item stacks are not equal
show what you have
this is the item stack
public ItemStack NeptuneBoots() {
ItemStack NB = new ItemStack(Material.LEATHER_BOOTS);
LeatherArmorMeta meta = (LeatherArmorMeta) NB.getItemMeta();
assert meta != null;
meta.setColor(Color.fromRGB(0, 87, 123));
meta.setUnbreakable(true);
meta.setDisplayName(ChatColor.LIGHT_PURPLE + "Neptune's Boots");
meta.addItemFlags(ItemFlag.HIDE_ATTRIBUTES);
meta.addItemFlags(ItemFlag.HIDE_UNBREAKABLE);
meta.addEnchant(Enchantment.PROTECTION_ENVIRONMENTAL, 4, false);
meta.addEnchant(Enchantment.THORNS, 3, false);
meta.addEnchant(Enchantment.PROTECTION_FALL, 4, false);
meta.addAttributeModifier(Attribute.GENERIC_ARMOR, new AttributeModifier("generic.armor", 6.25, AttributeModifier.Operation.ADD_NUMBER));
ArrayList<String> lore = new ArrayList<>();
lore.add("");
lore.add(ChatColor.GOLD + "Full Set Bonus: Oceanborn");
lore.add(ChatColor.GRAY + "While in water or during rain,");
lore.add(ChatColor.GRAY + "increase attack damage along with");
lore.add(ChatColor.GRAY + "movement speed by 50%.");
lore.add("");
lore.add(ChatColor.LIGHT_PURPLE + "" + ChatColor.BOLD + "MYTHIC BOOTS");
meta.setLore(lore);
NB.setItemMeta(meta);
return NB;
}
@EventHandler
public void onArmourEquip(InventoryClickEvent event) {
Armours armours = new Armours();
Player player = (Player) event.getWhoClicked();
System.out.println(player.getInventory().getHelmet().equals(armours.NeptuneCrown()));
if (player.getInventory().getHelmet().getItemMeta().equals(armours.NeptuneCrown().getItemMeta()) && player.getInventory().getChestplate().equals(armours.NeptuneChestplate()) && player.getInventory().getLeggings().equals(armours.NeptuneLeggings()) && player.getInventory().getBoots().equals(armours.NeptuneBoots())) {
BukkitTask applyEffect = new BukkitRunnable() {
@Override
public void run() {
if (player.getInventory().getHelmet().equals(armours.NeptuneCrown()) && player.getInventory().getChestplate().equals(armours.NeptuneChestplate()) && player.getInventory().getLeggings().equals(armours.NeptuneLeggings()) && player.getInventory().getBoots().equals(armours.NeptuneBoots())) {
player.addPotionEffect(new PotionEffect(PotionEffectType.SPEED, 5, 3));
player.addPotionEffect(new PotionEffect(PotionEffectType.INCREASE_DAMAGE, 5, 2));
} else {
cancel();
}
}
}.runTaskTimer(plugin, 0L, 100L);
}
}
}
scam?
Is it possible to have player.PerformCommand not send a message to the player?
I'm getting this, while trying to package my plugin Source option 5 is no longer supported. Use 7 or later.
what i mean by this is im trying to apply a potion effect and i dont want the "effect is applied to player" message btw
I realized that was a lil vague