#help-archived
1 messages · Page 52 of 1
@remote socket oh sorry didn't know that... then I suggest you try it, or if you want to be sure, you can always use String#toLowercase
The thing with it is the breaking of 3X3X1 works in almost all directions a player is facing l, but when direction of rotation starts to be negative like SouthEast, it doesn't run the event.
And gives me this error
if it does not run the event, the this code should not be executed at all?
The event is supposed to look at which direction you're facing and mine in a 3x3x1 direction whichever way you look
It's a pickaxe tool
That you get with a cmd
I get it, only thing I don't get, what is null in there, as if it was super_pickaxe, it would crash at the top of the code... if it was dirblock, it should crash on the assert...
So what do you think I should do?
if you can debug, I would suggest placing breakpoint in the for and try looking on what is null, if not, try outputting all the variables and subsequent calls in that for into console...
Alright thank you, I'll try that!
if that doesn't help, share what have you outputted and outputs themselves...
Only thing is, the console points the errir in the dirblock.getRelative(x, 0, z).breakNaturally(explosive_pickaxe);
So Idk if something should be changed in there
i would output dirblock, dirblock.getRelative(x, 0, z) and explosive_pickaxe
Where is dirblock set?
Block dirblock =null;
well its null
yea but under that there are bunch of ifs, which do set it...
I know, I'm pointing it to all directions
but what is also possible that the assert is caught somewhere, so it is null in the ned...
I'm forking a plugin, and they used Settings.blockValues.containsKey(md), I would like to check if the cs.getSpawnedType() is in the config. If i add PIG_ZOMBIE for example should it work if I just do Settings.blockValues.containsKey(cs.getSpawnedType())
Yah they are @bronze horizon
so what if that doesn't run
@bronze horizon yes, it can possible be null, what confuses me is that he has assert dirblock != null above that... it should fail on that, shouldn't it?
But I put that there to not null the getRelative
if it's failing on the dirblock method then it isnt right
can i see your code?
where you set dirblock
please
Sure
thanks
alright
it will set dirblock to something wherever a player is facing
BUT
what if that relative block is empty?
then it's null, right?
it should be AIR, then, shouldn't it?
well getRelative cannot return null...
Where inn my code ?
try the debug outputs...
Set AIR to what?
use Bukkit.getLogger().info(...)
@median wing nothing, he was talking if player was looking into nothing it would return null, but it should return AIR
Ah
doesn't matter, it would crash as soon as block.anything is called....
good point
How can i set an armorstands head pose to face the player?
duck im doing some tests gimme a sec
How do you get if an item was clicked in the normal inventory?
Still can't figure why it;s doing that, hmmm?!
Can someone tell me how to get "discord": with
https.get(`https://api.spigotmc.org/simple/0.1/index.php?action=getAuthor&id=${args[0]}`, async res => {
res.on('data', d => {
if(d.identities.discord == message.author.tag) {
message.member.roles.add(message.guild.roles.cache.find(r => r.name.toLowerCase() == 'verified').id);
message.reply('Successfully verified your account!');
} else message.reply('Invalid Discord!\nMake sure to put your Discord Tag under your profile!');
});
});
d = {"id":"642407","username":"SpokenWig620933","resource_count":"0","identities":{"discord":"RedstoneGamer#4122","youtube":"Redstone Gamer123"},"avatar":{"info":"1557348459","hash":""}}
Im using https://github.com/SpigotMC/XenforoResourceManagerAPI with the getAuthor method.
d.identities.discord should work?
I'm new to spigot. Tried to fork ASkyBlock and theres a lotta errors when trying to compile that are unrelated to my small chance.
Some problems were encountered while building the effective model for com.wasteofplastic:askyblock:jar:3.0.9.4
'dependencies.dependency.version' for net.milkbowl.vault:VaultAPI:jar is either LATEST or RELEASE (both of them are being deprecated) @ line 101, column 13
'dependencies.dependency.version' for com.sk89q:worldguard:jar is either LATEST or RELEASE (both of them are being deprecated) @ line 106, column 13
'dependencies.dependency.systemPath' for com.songoda:UltimateStacker:jar should not point at files within the project directory, ${project.basedir}/dependencies/UltimateStacker-1.11.10.jar will be unresolvable by dependent projects @ line 121, column 16
It is highly recommended to fix these problems because they threaten the stability of your build.
For this reason, future Maven versions might no longer support building such malformed projects.
Can anybody assist me?
Thanks @bronze marten That worked amazingly!
@bronze horizon yah BlockBreakEvent
yah
Block block = e.getBlock()
ill send you the code you try it ok?
ok
double rotation = Math.abs((player.getLocation().getYaw()) % 360);
if (0 <= rotation && rotation < 22.5) {
player.sendMessage("South");
dirblock = block.getRelative(BlockFace.SOUTH);
} else if (22.5 <= rotation && rotation < 67.5) {
player.sendMessage("SouthWest");
dirblock = block.getRelative(BlockFace.SOUTH_WEST);
} else if (67.5 <= rotation && rotation < 112.5) {
player.sendMessage("West");
dirblock = block.getRelative(BlockFace.WEST);
} else if (112.5 <= rotation && rotation < 157.5) {
player.sendMessage("NorthWest");
dirblock = block.getRelative(BlockFace.NORTH_WEST);
} else if (157.5 <= rotation && rotation < 202.5) {
player.sendMessage("North");
dirblock = block.getRelative(BlockFace.NORTH);
} else if (202.5 <= rotation && rotation < 247.5) {
player.sendMessage("NorthEast");
dirblock = block.getRelative(BlockFace.NORTH_EAST);
} else if (247.5 <= rotation && rotation < 292.5) {
player.sendMessage("East");
dirblock = block.getRelative(BlockFace.EAST);
} else if (292.5 <= rotation && rotation < 337.5) {
player.sendMessage("SouthEast");
dirblock = block.getRelative(BlockFace.SOUTH_EAST);
} else if (337.5 <= rotation && rotation <= 360) {
player.sendMessage("South");
dirblock = block.getRelative(BlockFace.SOUTH);
}
Okay, I'll try it and tell you how it goes
k
bruh
whats up
How can I make an armorstand always be to the left of the eye location of the player
teleport
bruh
teleport it to the players location but slightly to the left?
To the left of the player constantly, so the player can't look directly at it
right
teleport in runnable
damn that thing
yes left but right as in correct
if you were to use Kotlin it would look so nicer
new BukkitRunnable() {
@Override
public void run() {
Player p = Bukkit.getPlayer("OHSRY");
Vector direction = getVector(as).subtract(getVector(p)).normalize();
double x = direction.getX();
double y = direction.getY();
double z = direction.getZ();
Location changed = p.getEyeLocation().clone();
changed.setYaw(180 - toDegree(Math.atan2(x,z)));
changed.setPitch(90 - toDegree(Math.atan(y)));
as.teleport(changed);
}
}.runTaskTimer(this, 3, 3);
}```
I have that
Ignore the other code, thats to make it so it just always looks at the player
why not do repeated division by 45 starting from 22.5
and then map those values 1-8 to their blockface value
i changed the rotations around and changed the rotation variable math
does it work?
Yah
cool
wait which line to, this? double rotation = Math.abs((player.getLocation().getYaw()) % 360);
yep
Anyone have any experience with WorldGuard API that can give me a hand?
dont ask to ask, just ask
Aight legit cannot get anything to work with the WorldGuard API, I'm literally just trying to query through the regions on the selected server to get information on the flags. More specifically the block-break and block-place flags as I want to validate that they are disabled/enabled
Already looking at the docs, explains some but I canny just implement it into my code :/
How would you get the index of a certain item in an inventory?
@ashen stirrup Loop through each slot and check if it contains and item, and if it does, if it is an item of the type you're looking for.
Okay
Need an example?
Nah all good
Great
umm i need help
@bronze horizon Everything works fine in my code, but when I changed the directions to correct ones, my event for the smelting feature which essentially autos melts for you does not work anymore, any ideas on why?
how do i implement one of my worlds to sprigot like i have the file of my world but where do i put it
How can you cancel all tasks in one plugin but not in all plugins on the server?
Is there a Spigot equivalent of Forge's PlayerTickEvent (i.e something that runs every tick that you can get a Player object from).
No. Though you can create a BukkitRunnable that runs once every tick and pass a Player
Does it have to be a specific player or can I run it on all players?
You can run one task on all players if you'd like. It's up to you. As far as the runnable is concerned, it runs on the server at any interval you want
new BukkitRunnable() {
@Override
public void run() {
// Do whatever you want here
for (Player player : Bukkit.getOnlinePlayers()) {
player.sendMessage("Hello world!");
}
}
}.runTaskTimer(plugin, 0L, 1L); // 0 tick delay, run every tick```
OK, thank you.
Or through the scheduler so you can use a lambda with the Runnable interface, but you don't have the ability to cancel from within the task

What is the 1.8 equivalent of this?
Didn't exist
1.12.0 it was added, Scribblz
Man I posted an update to Bukkit 2 days ago and it's still not been approved 😦 There must be a backlog or something?
other than that, no
if you try to connect..a vid world appears and after a few seconds..you get a crash
and then the error above appears
What's the /restart command supposed to do btw, because afaik without any plugins it can only stop the server
Spigot allows you to define a restart script
I'm assuming the cmd.bat it just whatever bat file I use to launch the server
sh
Is there a way to have it so NametagEdit only works in certain worlds?
I might be stupid but I don’t know how to make players deal more damage... I’m making an RPG plugin and I’ve made items which you click to add a prefix to your name. How do I make it so somebody with a “[Wa]” prefix deals .75 times normal damage? And how do I make them take that much?
Guys i wanna get the entityType from config but i couldnt make it
Can anyone help me about it ?
Version?
1.15.2
Registry.ENTITY_TYPE.get(namespacedkey)
NamespacedKey.minecraft("cow") for instance is equivalent to "minecraft:cow"
soo i am a newbie java user can u explain a bit about that code
i sould like to know what am i doing not just copy paste the code
i would be glad if u can
Registry is a class in Bukkit that has a bunch of different registry constants (including one for EntityType, ENTITY_TYPE). You're accessing it statically and calling get() which accepts a NamespacedKey. This is a unique, namespaced identifier for entity types
hi so is spigot a plugin or can you host a server on your own pc?
To get one with the Minecraft namespace (again I use minecraft:cow as an example), you would use NamespacedKey.minecraft("cow")
Why can I not give items w/custom model data with spigot
@bold hemlock Spigot is a server software you can host on your PC
Is this the correct way to get an instance of your plugin?
private final JavaPlugin plugin = new HealBackport()
No. The classpath will prevent you from constructing an instance of your plugin's class
?bt @bold hemlock v
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
tnku
pls send help
one of the common way is to pass your plugin as an argument, or use like getInstance();
Why can I not give items w/custom model data with spigot
So how can I create a new instance of my plugin in that case?
You don't. You should pass it through your class' constructor
:/
Can i ask one more thing when u are not bussy
public class MyListener implements Listener {
private final YourPluginClass plugin;
public MyListener(YourPluginClass plugin) {
this.plugin = plugin;
}
}```
oh you're doing this from in-game, not code, Novato?
Should be the exact same as you would do in vanilla
/give @p diamond_sword{CustomModelData:1}
You're using Essentials
It overrides a lot of vanilla commands (because lol, screw essentials)
Prefix your command with minecraft:
/minecraft:give @p diamond_sword{CustomModelData:1}
Okey can i ask one more question now ?
Registry.ENTITY_TYPE.get(NamespacedKey.minecraft(plugin.getConfig().getConfigurationSection("Bosslar").getConfigurationSection(args[0]).getString("Tür")));
So i am using this code to register an entity type from my config
How am i going to spawn it ?
Is there a simple way to disable using a custom item in a normal crafting recipe?
World has a spawnEntity() method or something that accepts an EntityType
Yes but i mean like in String a =... i am using a to get that string
What am i going to use to get that registered entity type
Sorry if i am bothering you i am newbie :/
You have it! get() will return an EntityType for you 🙂
Just assign that line to a variable
Is there a way to make an item only be used in a single craft?
Like make it have some custom tag thingie
Is there smthing like that in mc
shouldnt MemorySection#get("something", "default") be annotated with NotNull instead of nullable
Does anybody know how to use “entitydamagedbyentity”? I’m trying to make it so if a player has a prefix they deal more damage..
wouldnt it return the default val?
Default value can be null
ah yeah, it would look weird asf but yeah. thank you 👍
Is there some function similar to World#getHighestBlockAt, but not for the highest block, but for lowest possible spawnable location above specified location? Or I need to implement this myself?
Might have something in the height maps
Not 100% familiar with the height map API because it was recently added
Well default spawning behaviour woks this way? or does it use getHighestBlockAt?
Resp, when on Respawn I set Player location it has slightly "smarter" behaviour than just porting player to a Location
Don’t know the specifics
Ok, thanks anyway 🙂
so... does anyone here have an in-depth knowledge in the design of the entity activation range in Spigot? Because I've been wondering why the range only applies in the X/Z direction but not Y.
Ask aikar
thanks
Does anyone know if NBT data is preserved even after placing a block? I assign an NBT tag to an item, but:
NBTTagCompound nbt = event.block.getState().getSnapshotNBT()```
Contains the block's name, but not the NBT tag I assigned.
What API are you using. What?
That's NMS
event?
BlockPlaceEvent
Wait... Does blocks have nbt tags? I mean, a part from tile entities...
I'm aware of blocks being metadatable but..
Yeah, thought so.
TileEntity then?
If it's a tile entity, any NBT on the item not wrapped in BlockEntityTag will not be held
Hmm
In fact, it's discarded when read / saved afaik
The tile entities only care about what it needs
I might be better off saving the block's location instead of using NBT tags then
Yes, definitely
Thanks
If you look at any tile entity implementation, you'll see why this won't work
@median wing sorry for the late reply can you send your entire code in a dm pls
so i can have a look at all the events
Hello, I bought a plugin and it's not letting me download the plugin.
Give up to 24 hours. PayPal has reportedly been having processing issues as of late. If still not received after that time, contact the author with proof of purchase
Okay, Thanks.
@frigid ember You can't run a server if you can't figure out how to use WorldGuard.
No one is going to get on your server and do it for you, but you can ask us specific questions.
how long do resources take to get verified
like a month
crazy
POI data mismatch: never registered at BlockPosition{x=-51, y=69, z=-142}
Does anyone know what causes this?
It happens when I cancel a place event for a Blast Furnace, the same thing doesn't happen for a diamond blocks but I'm not sure about other blocks.
it happens when you cancel the placement of Villager job blocks
Is it a bug?
I don't know, I've ignored it so far and haven't noticed any issues
Just a bit annoying with the console spam
Latest version? afaik that hasn't been an issue for some time now
It may be as a result of the new villager points of interest. In such a case, a bug report on the JIRA would be nice
(Spigot's, not Mojang's)
👍
Just make sure you can replicate it on the latest version 🙂
Will do
?jira for reference. Thanks!
I might take a stab at fixing it once a report gets made
Though md will likely beat me to it because I work in a few hours
Can’t you?
😂
That dude deleted the message so it looks like I replied to Choco :/
😂
dont pm me, just post them
holy shit spartan is going full retard on your server
same with the framed maps from bkcommonlib
sssuuure
lmao
I mean, more ram for your server would hurt
3.6g is reaallly low
can someone help me figuring out why my placeholders aren't working with holographic displays?
well, do they run 1.15?
You're on a fork anyways. Why exactly are you asking questions regarding performance here?
how can you have mods on a bukkit server 🤔
you said paper
you said paper
but as I said, ram and gc isnt your number one issue
its your stupid anti cheat
and most likely excessive use of framed maps
well, or work with the author to figure out whats wrong
you paid for that, didnt you?
np bby
but like, you run an offline server anyways, sooooooo
nobody really cares
if said plugin uses 80% of lag ticks using a single scheduler I blame it, yes
I named 3 things to look at, he should look at all those things
I mean google and read
you probably added the wrong permission in the config.yml
or didn't gave the users the proper group
i mean
its should be enabled by default
Hey @subtle blade, I was wondering if you could accept my friend request, just need some help 🙂 Preferably in private.
i don't think he does help in private
It's quite complex, and I'd prefer not to get accused of calling another member out.
🤷♂️ ok
have a huge problem with lagg on my server, not related by entities or chunks, the server doesnt take all the gb it needs, it have 7gb and only takes 4. We are using paper
DMs are open. Don't need to FR me
Is chunk#getBlock any faster than world#getBlock?
ie: would getting the chunk and getting lots of blocks from that, be faster than getting lots of blocks within one chunk directly from a world.
have a huge problem with lagg on my server, not related by entities or chunks, the server doesnt take all the gb it needs, it have 7gb and only takes 4. We are using paper
Bobby_Harron
do you have matching heap flags for the JVM?
what message do you get when you execute /server
on default group
@median hill Are your JVM flags correct?
@frigid ember what permissions manager are you using on your server? And which version is your server? (Spigot not bungee)
where i can find test builds for 1.16?
thanks choco
@frigid ember are all servers using luckperms?
Why do my plugin Material broke
I've compiled with spigot 1.15.2, set api-version to "1.15" and run the server on spigot 1.15
But it seems like material comparison (In switch-case ) return false when it's suppose to be true
Let's see the plugin.yml and the switch (& relevant code)
Have you tried running some System.out.println to make sure you’re comparing the correct things?
In some case it does work, some case doesn't work
(Some material comparison failed)
I've had this problem before when I didn't specify API version but I did this time so I am quite confused
Let's see the plugin.yml and the switch (& relevant code)
Like it's working fine when compare grass, but not for coral
@subtle blade jeez calm I'm opening it xD
Let's see the plugin.yml and the switch (& relevant code)
lol
FASTER FASTER FASTER

Oof someone please slap me 😅

Well that was embarrassing xD
You're saying 4 GB of RAM isn't enough. I know 100 plugins, 2.5 GB of RAM and everything's fine.
And some programs are more memory-hungry than others
You can't look at one environment and apply it to every single other one
I can't remember if it's 6 hours or 4
I'm leaning towards 6
Also, that's legacy API. Recommend switching to simple
is there examples there?
Yep
ill check it out, thank you
I don't think so, no. Though update checks shouldn't be to the minute accurate either. Just wasteful API checking
Can understand the desire for at least a webhook though. That might be an option if you create an issue on that repository I linked above
ah ok, it must have been a coincidence then when I updated the version on spigot I saw it almost immediately after
With webhooks you could at least listen on that in a Discord bot or whatever
Minecraft server, even when online, refuses to connect.
Idk what it is
Help
Also, if you recommend a free domain service please tell me
Ping me to get my attention
Can you get if the inventory you clicked in is a chest?
Store player from PlayerInteractEvent
oh
@subtle blade is api-version a string?
it's a string
yes its a string
yaml falls back to strings
ahh
to disable the legacy material combat layer
and to be able to actually use new materials, lol
hmm ok
Basically says your plugin won’t work with any version lower than that
I put 1.13 but mine all work 1.8-1.15.2 ( I use a Material layer )
same
i mean '1.15' does not have any sense as the moment, unless you don't want people <1.15 to use your plugin
ping me if u know something about my problem
imagine supporting 1.8
no
I can make that everywhere
but I guess ppl over on that fork that shall not be named are more sane in that regard, ye
75% 1.15 🦾
bStats eh
i see 55.7% using 1.15.2
but from that 55.7 % it's 100% 1.15.2 :d
thats global
I mean why would they use a previous release of it
I was speaking about stats about the fork that shall not be named
oh we were talking about that other fork
which has 77% on 11.5
11.5
That's behind!
🧠
Why are we not allowed to say the fork it's name?
Can't believe spigot is 14 versions behind
so I dont get why I would put 1.15
or 1.13
Also prevents loading on previous versions (as of 1.13 when it was added, obviously)
Some of my plugins specify 1.15 because API was added in those versions that I rely on
is it only me who uses Paint 3D to visualize stuff
like i can't think if i don't see stuff in 3D
when working with solids
idk about your semver choco, but 1.15 is behind 11.5 😄
"Why are we not allowed to say the fork it's name?"
well, saying paper isnt banned
but discussion of forks here doesnt make much sense
and I just like joking around, I think its a funny term 😄
'The forbidden build' :p
Is there a way to send one message every 3 seconds on playerMovementEvent thanks
Anyone know of a plugin like this but for 1.15 https://www.spigotmc.org/resources/killstats.2098/
@silver pewter If you're looking for a pre made plugin, not sure. If you're a programmer, you can store the time when you send a message. Every time you want to send a message check if that time + 3 seconds is greater than the current time. If so you can send a new message, and otherwise you cancel the message 🙂
** anyone know if there is a flag for world guard so that tools don't lose durability ? **
@marble narwhal I've done that but it sends x amount of messages on where I walk
Do you have some code to show?
Yeah
I'm not sure if there is one Dangerous D:
@marble narwhal look in dms
@frigid ember I see this mentioned on the plugin page. Are you sure these things aren't the case?
Make sure you do not have permissions for the following permission node:
worldguard.region.bypass.<world>.<region>.<flag>
Also make sure you have use-player-move-event set to true in WorldGuard config.
Please also note that if you are OP you have all the permissions, meaning that you are bypassing every flag the plugin provides. This can look like the plugin is not working.```
Choco
about that thing you told me earlier about particles
so each particle get sent as an individual packet
?
To update my server, do I get the new jar and just swap it out
anyone got any idea how to set the blockplacespeed of an editsession/operation with asyncworldedit?
How do you use Messenger to send a message? I only see things to deal with channels, but I don't know where else to look
@frigid ember Then try it without OP 🙂
also that's for sending packets to the client, right?
Then I'm not sure Dangerous.
Because the page description says so. Did you read what I send you? OP might cause issues with some flags.
@wicked atlas What is it you're trying to do?
By using a permission plugin.
And let me check realy quick redstoneguy 🙂
I've never used pex, I'm sorry. Try looking at some kind of wiki or anything similar.
PEX has documentation pages, and yes you can do it from the console
Does anyone know how I would go about sending a custom packet to the client? I can't find any way to actually send a message in the channels created with Messenger
@wicked atlas I've found what I was looking for. https://dinnerbone.com/blog/2012/01/13/minecraft-plugin-channels-messaging/
At the bottom there is an example of how it can work 🙂
@frigid ember what MC version you using?
PEX on 1.15?
really?
uhm
It's probably as broken as GM on 1.15
I think they were referring to Group Manager.
Thank you so much, Thom
Np ^^
Yeah GM as in Group Manager
not gamemode
as far as I'm aware there's no complete official 1.15 pex or am I mistaken?
I don't have WG, I'm also not going to mess with it because it's getting late for me.
How should i go about caching skins? 🤔
Can you be a bit more specific, Fr33styler. What is it you're trying to do?
cache the game profile
I mean the server does it anyways and I think you can increase the cache size
What is the difference between Bukkit and CraftBukkit?
bukkit is the api
craftbukkit is the server implementation that implements the bukkit api
someone help me with this
Are you messing around with packets?
Can I import stuff from CraftBukkit in my plugin? @keen compass
oh no JSON files shudders
You're not dumb for messing around with packets lol, how else would plugins like ViaVersion be made.
its via version?
I think that was just an example
That is not what I was trying to say, but it could be a ViaVersion problem if you've that plugin running yes.
Try updating your plugins that mess around with the protocol, so ViaVersion, ViaBackwards, ProtocolSupport, ProtocolLib. Whatever you've running. And if that doesn't work try to figure out which plugin is messing up your client.
And report the issue to the creator of that plugin.
Is there no event to detect when a player's saturation/exhaustion changes? I found FoodLevelChangeEvent, but can't find anything for the others. I'm hoping I'm just bad at searching
people are timing out now
Looking at this I don't think there is one :(
https://hub.spigotmc.org/jira/browse/SPIGOT-5349
Performance wise, yes.
That’s a weird one to implement because adding 2 new events for very similar concepts is gross
Only thing you could do is check on damage or on food level drop
Though if we were to add it into the existing event, say with constants as reasons, it would break compat with old plugins
Because they would be expecting only food changes
I'm reimplementing the server part of appleskin on spigot, so I really need to know when exhastion/saturation changes
I would much prefer such an event not getting renamed xd
Wouldn’t be renamed but have constants added to not break binary compat, just logical compat
Can't you just deprecate the food event and make a new one, like HungerChangeEvent or something?
Wouldn’t be renamed but have constants added to not break binary compat, just logical compat
But then the name of the event would not really match what is actually happening. It's not just food changing.
That would be the likely approach, yes
Are saturation and exhaustion exposed already through the API? In the Player interface?
(On my phone, can’t check)
yep
Using the Citizens-API. How would I cancel equipment of armor right clicking on a NPC, whilst holding armor? I'm currently using the NPCRightClickEvent.
Exhaustion too?
yes
so is repeatedly checking it my best bet for now?
Yea there should be an event. I’ll see about adding it tomorrow
I’ll likely take the deprecate and new event approach
What do you mean deprecate?
Oh okay
Are you a spigot contributor?
Yes
Makes more sense than what I thought you were talking about.
how often does spigot release? should I just wait for a new spigot release?
oh wow
BuildTools isn't always updated though.
It is
Oh you mean BT itself, yea
Though it’ll build the most recent Spigot by default
I’ll have to write that event down so I don’t forget lol. About to start my shift
Good luck ^^
Also @late tangle you probably want to use the https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/player/PlayerInteractEntityEvent.html
The Citizens API should have a method somewhere to check if an entity is a NPC.
@radiant pollen what needs to be updated with buildtools?
I was just saying that just because you run the latest BuildTools and get the latest version on there doesn't mean it's the newest release of Spigot.
^
anyone got any good tutorial on abstraction ?
preferably, something that covers every scenario
That does bring up the question, how do people usually deal with API changes which are not NMS? I had been thinking about it today but couldn’t really come up with a good solution..
@marble narwhal Didn't work unfortunately. For now I've just set it to left-click on that NPC. But still want it to work with the armor part however. :/
That does bring up the question, how do people usually deal with API changes other then NMS? I had been thinking about it today but couldn’t really come up with a good solution..
@marble narwhal I would not add a new layer of abstraction, I just would release an update
Dropping older versions you mean?
well, no, I just would create a version 2.x for the new api version
probably reflection
I probably explained it wrong, imagine Spigot renaming a class, or adding a new method in version X, which previously had to be done with NMS. And you want to update so you don’t have to use NMS for new Spigot versions. How would you properly abstract such things
oh god, I totally misunderstood you
My bad, don’t worry 😅
uhm, I would go to my NMSManager class I have in every plugin of mine using NMS and replace my NMS abstraction with the API one
and deprecate it
and in some release, when I managed to refactor everything using this feature, I'd remove my NMS abstraction completely
i cant figure out how to hook papi into my plugin
yeah
the method is deprecated and the other one doesnt make sense to me
Which method
@vale slate Thanks, you gave me an idea on how I could approach what I want. I’m going to sleep btw, good night all ^^
MinecraftServer.getServer() is deprectated, but it is not indicated what is the newer alternative. Someone knows the new function?
Can somebody explain why I can still use the command on myself? if(target == cms.getName())
and the next one
new Placeholders(this).hook();
I also tried it with the players doesnt work either
MinecraftServer.getServer()is deprectated, but it is not indicated what is the newer alternative. Someone knows the new function?
@bitter tendon Why are you working with the NMS McServer
Yes it it
Bro
it is*
You don't?
you use .equals()
OUCH
^
or equalsIgnoreCase
There are some odd situations where == is fine , but certainly not yours
I'm doing a comand manager, and I need to get the CommandListenerWrapper and access other nms stuff as well. But MinecraftServer.getServer() is deprectaed, so I was wondering if anyone knew the new function
@vale slate
Doesn't work with .equals and .equalsignorecase either
I'm doing a comand manager, and I need to get the
CommandListenerWrapperand access other nms stuff as well. ButMinecraftServer.getServer()is deprectaed, so I was wondering if anyone knew the new function
@bitter tendon ((CraftServer) Bukkit.getServer()).getHandle().getServer()
Player player = Bukkit.getPlayer(target)
String target = args[0].toString;
That is target
Awesome thank you @vale slate 😄
is this the right way to register placeholders
if(Bukkit.getPluginManager().getPlugin("PlaceholderAPI") != null) {
new Placeholders().register();
}
@sturdy oar you gone?
i did that it doesnt work
@pure pasture should definitely research ==, equals, and hashCode in java(And probably any language you do because it wont work the same way in every language)
== does a pointer comparison when dealing with objects(can use it fine on primitive data types). In most cases doing == with strings wont work unless the JVM recognizes them as 'final and never changing' and optimizes it on compile which in your case will never happen.
I've had to deal with a few optimized variables in the past and its always fun trying to do some hacky code to edit them after runtime.
You'll have to give more code though for anyone to help understand why if(target.equalsIgnoreCase(cms.getName()) fails. An easy way for you to help debug it is print/log both target and cms.getName()
EntityDamageByEntityEvent has a map of DamageModified and the amount of damage they reduced(Or dealt based on what enum value you use)
https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/entity/EntityDamageEvent.DamageModifier.html
and you should be able to just change armor to 0 using #setDamage https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/entity/EntityDamageEvent.html#setDamage-org.bukkit.event.entity.EntityDamageEvent.DamageModifier-double-
@warm ginkgo
looks like you do need to do isApplicable to prevent UnsupportedOperationException from happening if the modifiers map does not have the armor enum value as a key in the map.
This is all deprecated but hopefully a new method pops up to do the same whenever its actually removed.. And also hopefully this even still works at all
i got the digital dash
How to convert net.minecraft.server.v1_15_R1.Entity to org.bukkit.entity.Entity? (Also for EntityPlayer to Player)
don't you do getHandle to get CraftEntity and then that can cast to bukkit entity
delete the net.mc import
then hover where you get the entity and import the org.bukkit version
or also do that if you're importing wrong
you remind me of a quaterback
hopefully you understand the possibility of importing wrong class tho if you putting spigot as depend instead of the api
I'm using the right imports, I just need to go from vanilla class reference to bukkit class reference
For an arrow, this is how it goes from bukkit to vanilla:
net.minecraft.server.v1_15_R1.Entity arrow = ((CraftArrow) entity).getHandle();
But I do not know the other way around
@bitter tendon ignore them
CraftEntity.getEntity(server, entity);
will get you back to craft entity
which you can cast to your bukkit entity
because craft entity takes a server in constructor
oh.. it makes an entirely new object..
yep
Thanks @dusty topaz what should I put in as the server parameter?
is there any difference at all between org.Bukkits ChatColor and net.md_5’s
i never realized i mixed the two
one is bungee one is bukkit
Alright, thanks 😄
Can I ask how you ended up in that position
where you have an nms entity and need to get a bukkit entity
I'm making a command manager and messing with brigadier to do so
Is there also a function to convert a List of entities all at once?
Could someone help me with the following error when connecting to server? Could not connect to default or fallback server. I have been messing with config files for awhile. Help?!
How can I use a stream?
something like
list1.forEach(x -> list2.add(CraftEntity.getEntity((CraftServer) Bukkit.getServer(), x)));
ooo, nice thanks again
using getBukkitEntity is definitely better because its cached on the Entity instead of new object each time
unaware of such a method
but if its cached then yea
yep they're right, use Entity#getBukkitEntity instead
List<CraftEntity> entities = list.stream()
.map(x -> CraftEntity.getEntity((CraftServer) Bukkit.getServer(), x)))
.collect(Collectors.toList());
😦
List<org.bukkit.entity.Entity> list = list1.stream().map(Entity::getBukkitEntity).collect(Collectors.toList());
there
😎
Wait, how is there a bukkit function getBukkitEntity() in a vanilla class? o_O
Those are nice oscazz & AcroVulcan 😄
@vital delta isn't nice 😠
I was refering to the code anyway xd
The type Entity does not define getBukkitEntity(EntityPlayer) that is applicable here
You've got a list of entity players
getBukkitEntity is returning entities
would need to cast separately in that case
show the code?
Same for getBukkitEntity on a EntityPlayer?
List<org.bukkit.entity.Entity> list = list1.stream().map(Entity::getBukkitEntity).collect(Collectors.toList());
With entities it also does not work:
Same error
Was using the wrong entity, this works:
Is there another way to then writing the entire namespace where there are two confliciting class names?
why are you making a new list and then sreaming it
the new list you're making is empty
so streaming makes no iterations
Yeah, it was just to test if it worked
How can i update a score in the scoreboard with out p.setScoreboard?
within the "commands.yml" how would i go about disabling /mv version? normal players can use that command, dont know how or why if they dont have perms for it....
i tried but you can still access command?
` mv version:
- []`
What permissions system are you using?
Guessing mv=multiverse, if your using luckperms set multiverse.core.version to false for defaults or if it’s something like permissionsex set ‘- -multiverse.core.version’ to default group
Or get a blocked-commands plugins that you can set new permissions to the command that are in a list. There’s a lot around, if you know java it’s quite simple.
anyone, is there a 1.15.1 protocal support
via version?
-_-
if you dont explain the question
your question is 6 words long
is there a spigot 1.15.1 verson of this https://www.spigotmc.org/resources/protocolsupport.7201/
In theory wouldn't the 1.15.2 version work there? @frigid ember
@toxic moat l a z y
What do you mean? You asked if there was a 1.15.1 version of ProtocolSupport. They have a 1.15.2 version available. Wouldn't that work?
yo anyone know title manager? i changed some stuff and am now getting errors
the side panel thing
just a internal error occurred when preforming this command
Paste your config and the stack trace.
thats the section i was editing
think i found it
got it working
i was using grammer in the text so it messed up xD
It's probably not that.
no it works now
It's probably because one of the lines was more than 40 characters long.
whats the thing for ping isn't it %ping%
%{ping} I think
yep thx
No problem
hey by any chance you know the ones for Irdium Skyblock i can't find them online anywhere
You mean placeholders for Iridium Skyblock?
yes
thx again!
:D
No problem
Make sure you always check a plugin's Github page. There's usually a wiki.
know the one for player exp cause the one on iridium didn't work and %player_exp% didn't work
any advice for repeated server crash on join?
https://github.com/seanwineman/servercrash
It's my first time doing any server hosting
30.04 02:48:48 [Server] Spigot Watchdog Thread/ERROR me.qKing12.AuctionMaster.meniu.MeniuEvents2.onPlayerJoin(MeniuEvents2.java:77)
It's your auction plugin @golden chasm
Thank you so much <333333
No problem
@frigid ember If you're trying to use placeholders from PlaceholderAPI in Title Manager, try using the same format Title Manager uses.
Hello,
I'm having some issues with the entity.isOnGround() method. For some reason, when a ravager is set perfectly on the ground, entity.isOnGround() reads as false. I know for a fact that it is on the ground because I can directly see that it is on the ground. The only time that it correctly polls as true is generally the immediate moment that it touches the ground. I have absolutely no idea how to fix it. Any help would be appreciated.
Here is the full class: https://hastebin.com/eyexavulol.cpp
Note lines 47 and 62.
yeah still got nothing on that
@frigid ember Are you doing something funky with the Ravager? If you're cancelling move events or something that might mess with it. Taken from the docs: This value is a state updated by the server and is not recalculated unless the entity moves.
Not cancelling any move events I don't believe.. Of course, I do have a player mounted on top, no idea if that would interfere
I am cancelling the ravager's target ai
AFAIK, the isOnGround() method isn't always the best.
There might be a better way to check if an entity is on the ground.
IIRC, the height of every block is a multiple of 1/16. You could simply check if the remainder of the entity's height divided by (1/16) is 0. @frigid ember
You'd probably get some false positives, but there's probably some other checks you could do along with that.
That's slower and not always true.
There's a massive list of blocks that could be directly under you while you're flying.
You'd still technically be "on" that block.
So what you're saying is, get the entity's height, divide it by 16, and it should equal zero if it is on the ground?
The remainder should equal 0.
depends which method you use
if you use the method to get the block at the players feet
if they are flying it will be air
Not always.
You could be in the "air" and the block at the players feet could be grass, carpet, a fence, etc.
I don't see that being possible
since it is the server that checks that and not what the client sent
public static void isOnGround(Entity entity) {
Double entityHeight = entity.getHeight();
Double entityRemainder = entityHeight % 16;
if(entityRemainder == 0) {
return true;
} else {
return false;
}
}
Something like this?
entityHeight should not be an int. Otherwise it will always be on the ground.
You need the decimal values for height.
Ah so those should both be doubles then?
need it to be either a double or a float
How about that ^
Also, it's not % 16 it's % (1/16)
Are spawn limits per person? I'm having like an insane amount of mobs spawning
@radiant pollen, I appreciate your help.
The remainder is outputting as not a number (NaN) while debugging.
public static boolean isOnGround(Entity entity) {
double entityHeight = entity.getHeight();
double entityRemainder = entityHeight % (1/16);
Bukkit.broadcastMessage("Height" + String.valueOf(entityHeight));
Bukkit.broadcastMessage("Remainder" + String.valueOf(entityRemainder));
if(entityRemainder == 0) {
return true;
} else {
return false;
}
}
I suppose it would have something to do with the unusual height.
Oh wait
You're using entity.getHeight()
That's the actual height of the entity. You need to do entity.getLocation().getY();
Ah, I see. Will this still work for ravagers on slabs/unusual height blocks? I assume so because they increase by 1/16?
Yes it should still work.
Okay. So another problem I'm seeing with this is that if I were to press space in the air, while at a Y value that is divisible by 1/16, it will still return true even though it isn't on the ground
Yeah, that's what I mentioned before about false positive.
You could also check if entity.getVelocity().getY() == 0.
If they're going up or falling down from jumping, their velocity in the y direction won't be 0.
Ah! So then it would only return true if there was no prior Y velocity, that would make sense
Yup. Then the only false positive you would get is if the apex of the jump was a multiple of (1/16).
And even then, that might not be true because I think as soon as you reach the max height of the jump, the y velocity is negative.
I don't think you float for even a tick.
Gotcha. After switching to entity.getLocation().getY();, it appears that the remainder is still NaN
I'm at Y 88.0, which resolves as 88/(1/16)=5.5
Maybe change the (1/16) to (1.0/16.0)
It could be something weird with integer division. Honestly, I have no idea. Any number modulo 0 is just that number so I don't know why it would return NaN.
That seemed to work! Thank you so much @radiant pollen 🙂
You're welcome!
Im creating a custom enchant plugin. Whats the most efficient way to give speed 2 to a player who has the "Speed" custom enchant?
Player#addPotionEffects
Do i give that to the player everytime they move?
That's probably the signature.
No, if it's on armor, for example, you will give it to them when they equip the armor and remove it when they remove the armor
Hmm, using InventoryClickEvent?
Armor is a tricky thing because dispensers can equip armor, you can right click while holding armor, you can use inventory clicks.... ^^
but it's still under going review
I have a suggestion up for an EntityEquipmentEvent, probably similar
How would I implement EntityArmorChangeEvent into my plugin?
It's not officially in spigot yet
would need to use a workaround atm such as the first github link i sent
also @real valve i linked the PR if you wanna look and see if that has everything that you thought of
How could i add ArmorEquipEvent
You could clone the repo into your plugin
the github one I linked I think works on 1.8
Whats the DispenseArmorEvent for?
worst case you can use it as a base and modify the code to fix any issues
for when armor is equipped via dispenser?
gotcha
anyone know the like %{xp} thing for like gui sidebar things?
?
Yeah the BlockDispenseArmorEvent is not available on 1.8
like the side like scoreboard thing
called Title Manager is the plugin i use
actual armor change event pog
Also how would I be able to make custom enchant books and make them able to be applied via anvil?
It could be something weird with integer division
For reference, integer division will truncate the result
No decimals or anything
Yeah, but it's still weird. I didn't think it would fix it. @subtle blade
Truncating that would result in 0. AFAIK modulo 0 is still a number.
🤷♂️
Not gonna lie, I saw "integer division" and didn't read much else lol
So my message was at in response to that
Gotcha
is there anyway to fix the nametag when i drink invisible potion
some player can see it even when im invisible
@stable egret hm the fact only some players can see it makes me think they may have an illegal modification
It's a vanilla mechanic for nametag hide when invis so if they see your nametag either a plugin enables it or they are using a modification (or a glitch depending on your version)
my minecraft spigot server crashes Spigot version: git-Spigot-eb3d921-2b93d83 (MC: 1.12.2)
@raw atlas im pretty sure they will need to know more than that
Hello,
I'm looking for some help to allow my ravager entity to rotate while moving. Currently, the player riding the ravager can rotate the ravager's head and body (see line 48.) While the ravager is in motion (with the player using WASD,) the ravager's rotation resets to a default position. How might I fix this during the movement?
Full code: https://hastebin.com/idexeludow.java
Thank you!
Yaw and pitch
Let me understand
You're doing this in the bukkit api....
If you're using velocity you're gonna need to send rotation packets as often as you can
How might I send more?
Would I just duplicate entity.setRotation(playerEyeYaw, playerEyePitch); in each if statement?
hi i have problem in the spigot page when someone update a plugin i'm not getting any notifications
@atomic rapids
@tiny dagger I'm having trouble understanding what you mean - to clarify, I'm using ProtocolLib to handle the packets
Ah, darn
How can I make a plugin which grants the player temporary flight when he consumes an item
@tiny dagger when i click watch this resource will i get notifications?
Ladies & Gentlemen, I just had a discussion with a starting developer, who said that you could use a Enum for singleton instead. Does anyone have experience with this? I'm used to using the pattern, and as long as you initialize the first instance of your singleton on load or for spigot in the onEnable() method ,there should be no issues whatsoever using threads.
Any experiences?
Well, I just did some investigation, and seems it can be used indeed. I didn't knew that to start of.
And there are disadvantages as also stated in the documentation
and it also say's "This is also a good way to have singleton with minimum effort."
Java enums are nothing more than strictly enforced singletons
that can't extend any class
Well, Singleton is only used to store data in an instance in a non static way. So I don't see a point of extending it at all. So this is more of a preference ?
that's kotlin?
^
Then again, I use guice to manage my Singletons most of the time
Or just a simple getInstance method with a static instance field and a private ctor 🤷
That has the benefit of being able to be mocked in unit tests easily
also no lazy initization
This is all the singleton pattern, lmao
In fact, I might know a dependency
Just different impls of said pattern
Can you still send data to a Singleton based no Enum?
using the parameters
I guess not
Wut?
Yeah for example
Your singleton requires an instance of your main class
can you do that if it's based on an enum?
I guess not?
Well, your main class is a Singleton too, isn't it ;)
Yes
Alright, perfect
MiniDigger
the main class tho can't be a real singleton
because constructor can't be private
Wtf is a real Singleton?