#help-development
1 messages Β· Page 1619 of 1
https://www.spigotmc.org/threads/how-can-i-make-a-new-folder-in-the-plugin-folder-to-add-files-with-data.519579/page-2
this whole thing is just guys struggling to teach some guy java
2 pages
;-;
Oof looks like I forgot to save it
Minecraft wiki has a guide
It is
o
Read above as to why we're doing it
π
"#": {
"item": "minecraft:diamond",
"Unbreakable": 1
}
Maybe it's like this?
server loaded at least so we will see
less memory usage maybe
tl;dr testing custom recipes that don't seem to work correctly client-side when registered via a plugin
wdym
plugins are better in that aspect too?
I believe data packs only gets used when a player joins
plugins still better i think
plugins are always better but look at their reasoning above
this
plugins have almost infinite possibilities
and are more easy on servers
SOME plugins are
what??
This was correct, btw
it just means you suck at making it good
looks at FAWE
Recipe ingredient must be an unbreakable diamond- works exactly as if my plugin had registered it
We're talking about spigot capabilities not your capabilities
I wasn't talking about mine
yes ik
On the bright side I guess I can submit it as a bug to Mojang π€·ββοΈ
You sure π
What's your issue
That doesn't look right to me
also what shit r u saying
datapacks dont have events
they always have to rely on loops
so theyre wayyy worse than plugins
We are making Recipes
Yes
Yeah I'm sure, it worked π
arent recipes like so weird in datapacks
Aight
i would say just make a plugin for it
great deal there
way easier
No it's just JSON
I think you are missing the whole point
Yeah most people don't know Java though
even though I tl;dr'd it π
^
You literally replied to it π€£
To be fair, they replied to it with "?"
True true
I don't know how to summarize it better though, so there's my original question
o
I did not
its imaginedev not me
anyways u could just use ExactChoice in spigot
spigot for the win
but the sentiment was the same π
Oh well if it doesn't work with Vanilla create a bug report
oml
This really should be fixed
yep on it (the bug report)
Someone already submitted one but didn't do the work to test in vanilla
i mean would they rly care to fix it
Well if it's actually possible to do via a datapack then it's a great custom crafting feature that should be fixed
B/c custom model data, custom items, custom crafting- seems like a win
honestly
what makes datapacks a bit good
is that they work in singleplayer
they do, right?
yeah
hmm
Looking into le client for a bit, mojang specifically removes any damaged, enchanted or custom named items from the stacked contents that make up the base for recipe matching
This item is technically none of those things, it just has an unbreakable tag
but maybe that's lumped in too?
but fuck am i gonna redo 24 recipes? hell nah
Specifically net.minecraft.world.entity.player.StackedContents line 26
@eternal night btw ur tutorial is great
the one for pcd
i mean i learnt pcd weeks ago but thanksss
really useful :D
pdc?
PersistantDataContainer
hmm unbreakable does not seem to be part of it
thanks π only post on spigot forums of mine that ever got any attention lmao
hey everyone i'm trying to compare two itemstacks but one they have different attribute modifers uuids any suggestions.
Well I am dumb and my testing was flawed, the ingredients aren't unbreakable
I think this did not work
"#": {
"item": "minecraft:diamond",
"Unbreakable": 1
}
it just wants regular diamonds
Yeah that's what I thought
Tho, I see your point, the recipe is technically "valid" but cannot be transferred into the container
There is a way to do it via a datapack though?
Doesn't seem to work π¦
I tried Unbreakable (capital) as well
anyway to reload datapacks on the fly? π
how to ignore attribute modifers when comparing item stacks
how can i set a head block with the skin of a player?
Try isSimilar()
no-go as well
The server must parse datapacks, right? I should just find where that happens in the code...
Yeah
There is no API do this still (I don't think?) so it's gonna be kind of a mess
RIP me, sorry, I thought you meant via a texture URL
NMS contains code for auto generating recipies too
just by using setOwner it will change the texture to the player's skin?
what about skinrestorer and offline mode stuff
SkinRestorer can only set a player's skin to some other player's skin, right?
so you'd have to see if that plugin has an API so you can get the real player skin, use that in your skull
Just don't suport offline mode
Offline mode has become a cult lol
Don't help people breaking the EULA
this still counts attribute modifers uuid sadly
isSimilar only excludes stack size
oh whoop sorry π¦ I'm batting 0 here π
You'll have to make your own comparison method for that I'm guessing
What are you trying to compare?
ItemStacks ignoring only AttributeModifiers
but because of attributemodifer uuids they are different
even though everything else is identical
no idea, skin restorer makes players have the skin of their name in offline mode, but yea, you can also put a different skin to the skin of your name i think, but i dont care much about that, i just want to know if someone using skinrestorer will make my plugin work, or will they still see the default head skin
You could clone teh stack and remove all modifiers before comparing
True
hmm
That's probably the best idea
i live in pain
any one can tell me how to force permission on player which is OP
so event if they are op
they will need to have permission ?
suppose i should make it a method if i have to do it for a full set of armour
set default to not op
Set the default propery of permission
test isPermissionSet and hasPermission
if both are true while op they actually have the permission
thanks lol
I was unaware of isset method
^ assuming the perm manager is implemented correctly (PowerRanks has issues with both of those methods in my experience)
for years
I hope everyone is using LuckPerms lol
GroupManager π
π₯²
I've had people using both
dabestest
lol
I'm still partial to PEX π
I had to re-work all my permission checks for PowerRanks to not totally choke on my plugin π
you should be registering yoru permissions
You define them in the plugin.yml
https://github.com/zml2008/GroupManager @eternal oxide groupmanager?
what about
Okay, even deeper digging into the workings for recipe placement. The server only handles so called "stacking indexes", basically runtime int ids for item materials, when placing recipes
while the recipe matches
I assume they meant essentials gm?
god no
ugh so it sounds like it definitely won't work?
i need to set itemmeta right i can just use a.getItemMeta().removeAttributeModifier(Attribute.GENERIC_ARMOR);
But unless I can actually find a use-case in vanilla I don't think Mojang will care
and the client actually attempts to place the recipe, the server fails to find the respective "plain" item based on the stacking index in the player inventory as that logic does not consider unbreakable items the exact same as plain items
This would however mean that datapacks cannot add recipes using custom items too
sounds like that explains the behavior re: unbreakable vs named
this type of permission Economy.TokenDrops.Type.Mobs.Skeleton how to define it in plugin.yml
as they would fail at the same hurdle
well so far I'm not convinced there is even a syntax for a datapack to try
it would be crazy to type every mob type
The recipe parsing code in nms is semi indecipherable to me, just hoping to glean how I might try to put this in a datapack
@chrome beacon
so I guess the only really valid suggestion to mojang would be to allow datapacks to register recipes using custom named/nbt item stacks
You can defie lists
but again defie every mob ore in my case block
if you can already do that as of right now, my deep dive into the server source code must have missed something
Look at datagen classes
No I mean in plugin.yml - this is what I do for something similar
Magic.cast:
description: The spells a player may cast
type: list
Magic.cast.*:
description: A player may cast any spell
type: boolean
default: true
^
heh- no gm I've ever used seems to care about case, but yeah sue me it was 10 years ago and there wasn't really a standard I was aware of π
so list
do I need to have list in my code some where
and then plugin takes it
can you point me at a package?
on load
No PC atm
ah ok thanks anyway! π
olivo u on vac?
I don't think so, but I'm not entirely sure what you're trying to do
for example my perm work
like BeastTokens.TokenDrops.Type.Mobs.*
for all mobs
Ye
or for specific mob BeastTokens.TokenDrops.Type.Mobs.skeleton
where O.o?
Try net.minecraft.data
Yeh MrAxe the two perm blocks I pasted will do that- you just check for the mob type in your code, and they can either do "*" to have them all, or it'll act like a list and they can have specific mobs in the list
in my case I give * by default but you can change the default to false or op if you want
any way is it possible to use * in middle of permission
like Token.*.drop.*
if your permission is that exactly
thats not how wildcards work
it will not be treated as a wildcard
so only on end then
you can actually override it in spigot for some bizarre reason
ladies and gentleman i got it working
how can I get a player's total playtime in hours?
Read the statistic
wdym?
Statistic.PLAY_ONE_TICK I think
its PLAY_ONE_MINUTE
- 20 * 60 = hours π
derp, I was looking at 1.9 docs π
lmao why
.. reluctant backwards compatibility π
declaration: package: org.bukkit, interface: OfflinePlayer
here
but in the future
search through the javadocs yourself
?jd-s
no recipe nothing in there btw (oops sorry for ping)
you turned off sounds or how do you handle it?
Yeah it drives me nuts personally but glad I didn't bother you π
yeah same
if someone pings me and I am gone whilst, then once I come back it's literally a hell to find that one message mentioning me
how come? canβt you just look who pinged you
idk
There's a feature to see mentions
my discord doesnt work that way apparently
Are you on mobile
both
Because youβre conclure
touchΓ©
I just saved you 10 minutes

Im creating an Inventory GUI is there a safe & easy way to check if the open inventory is really from the plugin (so people cant just rename a chest etc.)
Hey, what's the maximum size of a minecraft inventory?
even if it's buggy
Check the instance or inventory holder
81 in some old versions not aware of how it looks in 1.17
yeah this is the one that looks buggy
I made one by accident
is it supported by IF?
lol alr
I thought it did
IF builds upon spigot iirc
^
how can i spawn falling block? i tried
FallingBlock chest = w.spawnFallingBlock(p.getLocation(), Material.CHEST, (byte) 0);``` but this place block if i'm on the ground, but if i'm flying it does nothing
Can you give a deeper explaination im not very experienced with java...
If you're not experienced use a library such as IF (InventoryFramework)
I have to get some sleep now
gn
Ok soooo I think I found what i was looking for, in RecipeItemStack.Provider.a(JsonObject) - it appears to only look at "item" and nothing else, so seems impossible to register anything but plain items as ingredients in vanilla π
Good Night :)
Unless there is some way to do it with tags but I have zero knowledge of how those work
Ingredient can have tag result cannot
I guess im just gonna put a permission check on all interactions too
is the PlayerDeathEvent fired if the player uses a totem of undying?
Anyway gn
I don't see how (oh thought you meant nbt - their use of "tag" here is very confusing)
but yes good night!
I will keep looking π
... actually, no, I will not - I give up. Pretty positive at this point it's not supported in vanilla, if anyone sees otherwise please tag me.
hey I am trying to create vehicles plugin, whats the best way to move player riding for example invisible armorstand? because that's probably the best way of doing this?
I was thinking about kindof copy horse movement logic
but its not really a solution
I had to dig into NMS to do that.. I made a PR a long time ago but it kind of died
There are some fields on the nms player you can read that basically map to WASD/space when they're in a vehicle
(including an armor stand or whatever mount)
what is your version @viral dome
oh, ok, well sounds like you got it- what's you're question?
but how do you actually move him
.setVelocity
https://hastebin.com/lakivohoge.yaml Hey, i want to check if the player have copper ore on slot 0 and coal on slot 1. It worked but only if i already have copper and coal on this slots. If the slots are empty and i place my coal and copper in the slots, nothing happends.
beacause to achieve smooth movement
why if i do PlayerDeathEvent#setKeepInventory(true) the player still drops its inventory?
Debug message in line 49&50 is the right material
how would you go for helicopter movement logic then? lets say you want to make it go up when press a and go down when press d
yeah I just set velocity every tick, not a huge deal- if you want them to hover without velocity I'm not sure there's a way other than giving them creative flight π€·ββοΈ
yeah but if they are flying gravity will bug as hell
I use space for up.. i think dismount is cancellable (again, recently) so you could use shift for down
hmm
If you want to try it to see what it feels like I can show you π
or maybe not
wait
if you disable gravity
it sould work
yeah
yeah
okay another thing I was thinking of
when you have horse right
you can ride 1 block up
like automatically
it would be hard to copy that with velocity?
because you must somehow knock up player
when he is reaching block wall
gravity?
of height 1
yeah I agree, that is hard and my vehicles don't handle 1-block ramps super well π
for flying ones it doesn't matter much, i think for cars I had to do some look-ahead and like bump it upwards and it all feels very awkward
you can have armorstand without gravity
yeah that's why I am thinking teleporting might be better
the low range one
idk how it was called in packets
because you would just tp player 1 up
and it would be smooth
hmm
its hard
keep in mind teleporting mounted entities is tricky
bukkit blocking it anyway
you gotta unmount everything, teleport the pieces and re-mount on the other end
doing that every time you want to move might look really weird π€·ββοΈ
I was testing with teleport packet
and I was teleporting mounted palyer
it was fine
but server desync
lol
doesn't sound very fine then π
well teleport packets should never be touched on real entities
but maybe you could hack into the entity location server-side and keep it in sync yourself? Sounds ugly tho
or just use some nms teleport methods
which do not prevent
from teleporting mounted players
but thats probably forbidden for a reason
yeah I went down that road, it's not just like "bukkit blocks it to be annoying"
another shit I am afraid of are physics of vehicles
for example you have some speed
and jump of a cliff
you should have parabolic road
and not hit the ground instantly
velocity in that case would be better ig?
hmm
@eager sapphire or just copy horse movement lol
like spawn dummy horse inside
and copy its movement
for block jumps
heh that'd be kind of intereseting π
ik thats true
for other mobs probably you would need to do some shit
like
extending armorstand
and replace it with other mobs
etc
yah if you are willing to create a custom mob then you could probably make a rideable armor stand .. I have still not tried custom mobs myself though
I am getting tempted to now that 1.17 forced me into version-specific packages though π
hey, how do i set the amount of players online when the ServerListPingEvent calls
I have java PlayerData data = playerMap.get(iPlayer.getUuid()); playerMap.put(UUID.fromString(e.getUniqueId().toString()), new PlayerData(iPlayer.getUuid())); and seems that PlayerData is null but I just don't see why it would: PlayerData class ```java
public Map<String, Long> cooldownMap = new HashMap<>();
private UUID playerUUID;
public PlayerData(UUID uuid) {
this.playerUUID = uuid;
}
public void addCooldown(String cooldown, Long time) {
cooldownMap.put(cooldown, time);
}```
playerMap isn't null and iplayer isn't null
wth? UUID.fromString(e.getUniqueId().toString()
convert to a UUID from a String, then back to a String?
getUniqueId() is a UUID
you are getting a UIID, converting that to a String, then converting back to a UUID
if you have an NPE error, break the line up to see what is null
It could be empty but the map itself won;t be null. It could return null on a get if there is no entry
https://hastebin.com/gewosisebe.csharp Can anyone help? My inventory Event dont get fired when i place a item in the empty slot
right it would just print {}
InventoryInteractEvent needs to be public and it need an annotation
oh you are passing into that method
then most likely you didn;t register your Listener class
Yes, you can't do that individually either. So neither of both works. It works when an item is already on that slot
So i think when i place an item on that slot, the slot is null. Idk why
Compare enums with == not .equals
Allright, sec
I want have my pseudo colored but that don't work why ?
Commands.Blue.addPlayer(player);
Commands.Blue.setColor(ChatColor.AQUA);
Teams work but with no color
maybe try putting the Blue.setColor before the use of it
actually no, that doesnt matter
Unfortunately does not work. Really strange. It works if an item is already on the slot but if none was there yet, I think the ClickEvent checks the type only after the item has been placed.
The event fires before the action takes place
so you have the option to cancel it,
you need to check the clicked slot and the item
Okay sec
Does anyone know of a way to simply make a permanent item in the last slot of the players inventry (similar to wynncraft or hypixel skyblock), where whenever someone right clicks the item, it runs a command like /menu
basically a menu item in the last slot of your inventory at all times
just set that slot of their hotbar
and see if they drop it or try to drag it
and cancel the event
Are you able to do if (!res.isBeforeFirst()) to check if resultset is empty?
what? if (rs.next()) { } else {// is empty}
if you do that won't you get Illegal operation on empty result set.
oh wait
im retarted
I just did it another way
https://hastebin.com/qehurebisi.csharp That works, i dont know if there is a better way to do that. My last Question: Is it possible to check that if the Player use SHIFT + CLICK on that item?
I mean on SHIFT + CLICK, nothing happends and i need to check that too
hey does anyone know how can i case switch on strings ? so far i have this but it wont work
switch (player.hasPermission()) {
case "permission1": break;
you can;t use hasPermission like that
why not
because thats not how the method nor switch statements work
so i'll haave to use if statements for every permission ?
yes
Worked, thanks! π
My votifierevent isnt work π€
https://paste.lucko.me/BSuUrNVsXV
im also registering the listener
error?
so what's suppose to happen
Right now just
Bukkit.broadcastMessage("Vote - " + vote.getServiceName() + " - " + vote.getUsername());
Im using NuVotifier v2.7.2 if that helps
could you print out player
well none of this code is even running
it's like votifier doesn't see it as a listener
then do ```if (player != null) {
PlayerLevelManager.checkVote(player);
} else {
Bukkit.broadcastMessage("1");
}````
I'm curious if the player is null
but it's not even doing the first bukkit.broadcastMessage();
I know
so the event isn't even running
Bukkit.getPluginManager().registerEvents(new VoteEvent(), this);
Instead of implementing Listener change it to VoteListener then in the event method change it to Vote
this is worth a try but idk if it's even gonna change anything instead of Bukkit. try getServer() when registering the event
Do you know where a reliable NuVotifier maven repo is?
Where do you have this line in?
onEnable()
and your onenable is being called?
yes
I just cant find a repo now for NuVotifier
or votifier in general
maven all fucky
Is there anyway for me to launch a projectile from 1 block left relative to the player, Player.launchProjectile() shoots from where the players head is with the right direction and im trying to do that just 1 block to the left
spawn the projectile and apply a velocity with a vector to the left
is there a way that i can make that go exactly one block (I havent really used vectors much i'm not sure how they work)
vecY = py;
vecZ = pz - pz-1;
new vector(vecX, vecY, vecZ)```
hey,,, how do i convert a list into something readable like "Entry1, entry2, entry3" etc.
im using List#toString() currently but that has [ and ] at the end
you could just List#toString().replace("[", "").replace("]", "")
fair
I lied
you can do this instead
also fair
List<String> list = Arrays.asList("A", "B", "C");
String delim = ", ";
String res = String.join(delim, list);```
ahhhh
thank you, i'll make a method for that or smt
no prob
isnt px-px+1 always 1
no prob
there is no way to add permissions consistently without using a permissions manager plugin, right? what if i want to make a plugin that adds or removes permissions, but being compatible with any permission manager? without having to add as softdepend every existing permission that currently exists and their corresponding apis??
you can use your permissions manager's api
Did i implement this wrong, arrow.velocity = Vector(p.location.x+1,p.location.y,p.location.z-1)?
i dont want to only support my permission manager
Vector vec = new Vector(p.location.x+1,p.location.y,p.location.z-1);
arrow.setVelocity(vec);
wdym
thats effectively what i did its just kotlin anyway it threw an error
what was the error
i know that a plugin can register itself as the permission manager, or something like that, so i think: maybe there is also a way to register a specific method that the spigot api will call when another plugin uses a spigot api method to add or remove a permission?? or something like that
if that doesnt exist, it definitely should
Excessive velocity set detected: tried to set velocity of entity #37114 to (-108.45421004992656,74.24918707874468,-49.2350891731692).
I think it is actually new Vector(1, 0, -1) @raw coral
I'm not too familiar with vectors tbh
what do you want it to do
is left
oh you just want left?
yeah then its Vector(0, 0, -1)
If i want multiple minigames going on at once but i only have one server do you think it would be a good idea to use different worlds?
yes, but it also depends on the ram/thread usage of each minigame
pretty much your only option
although
it would be more beneficial to do a server/minigame
^
ok thanks
okay
I'm using GSON to store my data, and it seems that when I try to save in onDisable it doesn't see some of my classes. I have a function saveAll that saves all the server data, and it's called in two cases: 1) If I run /pk save, or 2) when the server shuts down.
It saves just fine when I run /pk save, however when the server shuts down, this error occurs: ```
[20:07:08] [Server thread/ERROR]: Error occurred while disabling ScovillePlugin v1.0-SNAPSHOT (Is it up to date?)
java.lang.NoClassDefFoundError: net/emily/scovilleplugin/Types/CourseType$1
at net.emily.scovilleplugin.Types.CourseType.toInt(CourseType.java:9) ~[?:?]
at net.emily.scovilleplugin.Misc.SaveHelper.lambda$static$12(SaveHelper.java:90) ~[?:?]
at com.google.gson.internal.bind.TreeTypeAdapter.write(TreeTypeAdapter.java:81) ~[spigot.jar:git-Spigot-596221b-9a1fc1e]
at com.google.gson.internal.bind.TypeAdapterRuntimeTypeWrapper.write(TypeAdapterRuntimeTypeWrapper.java:69) ~[spigot.jar:git-Spigot-596221b-9a1fc1e]
at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$1.write(ReflectiveTypeAdapterFactory.java:125) ~[spigot.jar:git-Spigot-596221b-9a1fc1e]
at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.write(ReflectiveTypeAdapterFactory.java:243) ~[spigot.jar:git-Spigot-596221b-9a1fc1e]
...
The code for courseTypeJsonSerializer is:
private static final JsonSerializer<CourseType> courseTypeJsonSerializer = (courseType, type, jsonSerializationContext) -> {
Gson gson = new Gson();
System.out.println(courseType);
return gson.toJsonTree(courseType.toInt());
};
The println was for debugging
And toInt is defined as:
public int toInt() {
switch (this) {
case OPEN: return 1;
case RANKUP: return 2;
default: return 0;
}
}
The fact that it saves fine on /pk save but doesn't in onDisable makes me think this is a Spigot issue
Looks like there is a problem serializing a nested class here.
Btw why dont you use the ordinal of your enum instad of a custom toInt method?
You could try shading Gson in yourself and see if that fixes the problem.
The order at which they are fired is undefined. In this case it depends which listener was registered earlier
Alright I had these problems before...unfortunately I forget exactly what I did because maven is weird to figure out
How would I go about shading gson into the plugin?
It's probably just whichever you loaded first in the plugin
So like
new FooListener()
new BarListener()
FooListener would fire before BarListener
If you and the other plugin have the same priority then yours might be called earlier. But this is not guaranteed.
Ah, other plugins
Like you shade in other dependencies too. Add the maven shade plugin to your build plugins and add gson as dependency without the provided scope.
I think using the shaded version fixed it yeah
It's not erroring anymore at least and it's saving properly
Interesting. This might suggest that gson is somehow compromised when spigot unloads
I haven't seen anyone else with this problem, which leads me to believe it might have been something I did? That being said it was saving just fine and I hadn't changed anything about CourseType when it started erroring
Btw why dont you use the ordinal of your enum instad of a custom toInt method?
I assumed there was something like that but I guess I just wrote it weirdly into google because I didn't see anything, I'll look into it again, thanks!
hey does anyone know how to store someone's next message in a string, and ONLY the next one ?
Map<UUID, String> ?
What is the "next message"? How would you know someones next message?
You canβt predict the future with code fella

i want to make it so they click in a gui, and it prompts them to enter something in chat
a string
then i store this string
but it doesnt send message on chat
Want to take a look at my utility class for that? Getting a users chat input is quite useful.
sure i do
Hope thats not littering the chat...
public class ChatInput implements Listener {
private static final Map<UUID, Consumer<String>> PROMPTS = new HashMap<>();
public static void init(final JavaPlugin host) {
Bukkit.getPluginManager().registerEvents(new ChatInput(), host);
}
public static void create(final Player player, final Consumer<String> consumer) {
PROMPTS.put(player.getUniqueId(), consumer);
}
@EventHandler
public void onChat(final AsyncPlayerChatEvent event) {
final String msg = event.getMessage();
final UUID playerID = event.getPlayer().getUniqueId();
if (PROMPTS.containsKey(playerID)) {
TaskManager.getInstance().runBukkitSync(() -> PROMPTS.remove(playerID).accept(msg));
event.setCancelled(true);
}
}
@EventHandler
public void onQuit(final PlayerQuitEvent event) {
final UUID playerID = event.getPlayer().getUniqueId();
if (PROMPTS.containsKey(playerID)) {
TaskManager.getInstance().runBukkitSync(() -> PROMPTS.remove(playerID));
}
}
}
what are the links to show what to change to optomize server?
I only know this one:
https://www.spigotmc.org/threads/guide-server-optimizationβ‘.283181/
thanks!!!!!
If you want to use it.
In onEnable():
ChatInput.init(this);
Usage:
Player player = ...;
ChatInput.create(player, input -> System.out.println(input));
I just opened one of my old eclipse projects in intellij and i can't figure out this error, it says java: method does not override or implement a method from a supertype in this part ``` public static class OverridenServerDataSerializer extends ServerPing.ServerData.Serializer{
@Override
public ServerData a(JsonElement arg0, Type arg1, JsonDeserializationContext arg2) throws JsonParseException {
// TODO Auto-generated method stub
return super.a(arg0, arg1, arg2);
}
}```
The 'Serializer' is the one throwing the error
remove the annotation
Serializer still says 'Cannot resolve symbol 'Serializer''
It doesnβt recognize βSerializerβ
hover over it and see id you need to import something
I have it open in my other computer in eclipse and it recognizes it, im confused
there is something that isnβt imported
If using intellij, try βInvalidate caches & restartβ
Tried but still getting the error, i dont understand why its only in intellij, eclipse can compile it fine
π₯
if a have a location is there a way that i can get if that location is in an entity
yes, let me send a method
private double distanceRelative = 1; // Distance relative to be allowed in blocks
private Entity getEntityAt(Location loc) {
for (Entity e : loc.getChunk().getEntities()) {
if (e.getLocation().distance(loc) <= distanceRelative) {
return e;
}
}
return null;
}
@raw coral try this
it loops through each entity, and if the entity's location is smaller than the max distance set, it will return it
thanks!
i forgor π that method existed
woops
It seems random when it does and doesn't work
cause it just failed again
where can I find the implementation of org.bukkit.entity.Entity?
I think its prolly CraftEntity
isn't Entity an interface?
rip, even net.minecraft.util got remapped ;-;
cant use tuple across versions
I want to see the code of entity.level.getEntities() I cant find this "level" in CraftEntity
So this happens whenever a kit is chosen https://imgur.com/a/bNgjDtP and debugging it this is what's causing it ```java
public long getTime(IPlayer iPlayer, String cooldown) {
PlayerData data = playerMap.get(iPlayer.getUuid());
if (data.cooldownMap.get(cooldown) == null) {
data.addCooldown(cooldown, 0L);
}
return data.cooldownMap.get(cooldown);
}
what is level a class of
prob CraftWorld
` @Override
public List<org.bukkit.entity.Entity> getNearbyEntities(double x, double y, double z) {
List<Entity> notchEntityList = entity.level.getEntities(entity, entity.getBoundingBox().grow(x, y, z), Predicates.alwaysTrue());
List<org.bukkit.entity.Entity> bukkitEntityList = new java.util.ArrayList<org.bukkit.entity.Entity>(notchEntityList.size());
for (Entity e : notchEntityList) {
bukkitEntityList.add(e.getBukkitEntity());
}
return bukkitEntityList;
}`
It is in this method. Im trying to figure out how getNearbyEntitise works.
I cant find class Entity in net.minecraft.world.entity
You are on 1.17 right?
net.minecraft.world.entity.Entity Thats the full path
Thats basically what you want:
net.minecraft.world.entity.Entity entity = ...;
entity.getWorld().getEntities(...);
I find it in fabricmc minecraft-1.17.1-mapped-net.fabricmc.yarn-1.17.1+build.14-v2.jar
then what is a correct way to see the net.minecraft?
Run BuildTools on your machine. Then everything will be installed in your local maven repository.
?bt
I tried it and get code of craftbukkik, bukkit , but I ran into error and cant find net.minecraft. I will try it again
it worked this time. thanks
anybody know how to get enchantment display names
Names of Materials, Enchantments etc arent accessible in spigot. You basically need to write a dictionary yourself for that.
can nms help me
I mean the actual displayed enchantment depends on the language settings of the client... So its probably not possible to get the name of enchantments on the server side.
You can however use translatable components so the client translates them automatically when he sees the ItemStack.
Just put it in the items nbt yourself if you care that much
Why would you want log-villager-deaths set to true?
Because otherwise your console would look clean. And nobody wants that.
lol
hi
how doi i make a commmand only work in a specific server
on my bungee
but with bukkit api on spigot server
Huh?
ugh
hard 2 explaionm
so i want to be able to set specific servers in config
for what servers a certain command will work on
but i want it to be servers in the bunge config
make sense yet?
Is this config containing the whitelist on your bungee server?
Where do you register the command?
Wait. So the whitelist is in one of your spigot servers?
huh
nooo
i mean
i want to have a command right
on a spigot server
but i want it to check if the server it gets executed in
is a server specified in pluigins config]
Ah ok. Then send a plugin message to the bungee server and ask if your server is whitelisted.
You want a list like this:
commands:
buba:
allowed:
- "lobby 1"
- "lobby 2"
skills:
allowed:
- "rpg 1"
- "rpg 2"
mhm
Thats a whitelist
k
Let me see if there is an API way of handling dispatched commands on bungee side.
?jd
?help
selfrole Add or remove a selfrole from yourself.
cleanup Base command for deleting messages.
embedset Commands for toggling embeds on or off.
info Shows info about CafeBabe.
licenseinfo Get info about Red's licenses.
mydata Commands which interact with the data CafeBabe has about...
set Commands for changing CafeBabe's settings.
uptime Shows CafeBabe's uptime.
findcog Find which cog a command comes from.
names Show previous names and nicknames of a member.
listcases List cases for the specified member.
reason Specify a reason for a modlog case.
permissions Command permission management tools.
?ask
If you have a question, please just ask it. Don't look for staff or topic experts. Don't ask to ask or ask if people are awake or available. Just ask the question to the channel straight out, and wait patiently for a reply.
If you have a question, please just ask it. Don't look for staff or topic experts. Don't ask to ask or ask if people are awake or available. Just ask the question to the channel straight out, and wait patiently for a reply.
Ok so i found a solution.
When your bungee server starts: load the config into a Map<String, Set<String>> where the key is a command and the value is a Set of Strings containing all allowed servers.
Then listen for the ChatEvent on your bungee server. Check if its a command and if its in the map. If its in the map then get the set out of it and check if it contains the
servers name to which the command is being sent to. If its not in the Set then cancel the event.
If you have a question, please just ask it. Don't look for staff or topic experts. Don't ask to ask or ask if people are awake or available. Just ask the question to the channel straight out, and wait patiently for a reply.
ok
If you have a question, please just ask it. Don't look for staff or topic experts. Don't ask to ask or ask if people are awake or available. Just ask the question to the channel straight out, and wait patiently for a reply.
Dont spam the ask command -.-
https://letmegooglethat.com/?q=how+to+delete+custom+item+on+Friends+for+Spigot%3F+Version+1.8+-+1.13
What do you mean by "custom item"? How do you determine if an item is custom?
.
?
public void removeCustomItemsFromPlayer(final Player player) {
final Inventory inventory = player.getInventory();
for (int index = 0; index < inventory.getSize(); index++) {
final ItemStack itemStack = inventory.getItem(index);
if (this.isCustomItem(itemStack)) {
inventory.setItem(index, null);
}
}
}
private boolean isCustomItem(final ItemStack itemStack) {
// Do your custom item check here
}
is there a way to run certain code when a message in chat is clicked or at least run multiple commands?
You can run a command that lets the sender run multiple commands.
You can also just run a command that executes any method you want.
yea, just wondering if there was a better way because I dont want people to just be able to run the command whenever
There is a workaround for that π
nope its client side
Is there an event that is fired when a tree grows? BlockGrowEvent seem promising, but the docs only seem to mention crops
:o
this mentions trees
thanks!
You can make the command obscure like /gΓej9q54egh95jhug4e89hgj and hidden.
Then you can use a Map<Player, Consumer<Player>> that is accessed by the command.
If nothing is in there then nothing will happen.
You can also expand on that if you want mutliple clickable messages using tokens:
Map<Player, Map<String, Consumer<Player>>>
This way you can use one command for all your click actions with abstracting the whole command layer away from you.
Actually i need that in my new library... Let me write a mock up.
:o thanks, ill do that
This is what i just came up with:
https://gist.github.com/Flo0/54583c975f959a6fee6261a3fcba3dde
ooo nice
It maybe uses some dependencies you dont have but the general idea is there ^^
how do i only set the x y and z of a player, and leave their pitch and yaw alone?
A lot of helper methods :3
You can teleport them and use there pitch and yaw from before
i tried e.teleport, but it would still be really weird when looking around
i tried that
problem is
you only get their angle for that tick
and minecrafft makes it so when you look around your angle updates a ton
Store the angle you want to keep them at
i tried that, want a video of what it looks like, it looks really weird beacsue you keep getting teleported to that angle
It just teleports its back Iβm assuming but sure
You can do a hacky freeze with the jump boost potion iirc
Using one command and a map works until you want to have multiple click actions active at one time
I suppose you could just use one command with a single argument
Read a few messages further or look at the gist.
I have a TokenDomain per player that uses a Map<String, Consumer<Player>>
Sorry this is a really late reply but since i am dealing with locations the getNearbyEntities() function only works on the Entity class so is their any ways that i could get arround that other then spawning an invisible armorstand?
World has the same method
Unless you are stuck 5 years in the past
No π i just was unaware that the message existed
*method not message
im really tired
Ask the dev of CoreProtect
its a dupe glitch on 1.17, should i just listen for the item drop event, and get teh amount of ItemStack
Wut?
ya
its a huge dupe glitch on 1.17
the mod literally adds a "Dupe" button
IDK how it works
is this not patched in 1.17.1 π€ pretty sure it is
its a 1.17 server
Then update
so should i just listen for
lul
so should i just listen for the item drop event
and get the amount of the e.getItem() they dropped
Nope. You should update π
There is literally no drawback to that
you update
How do other plugin developers reduce their file size so much? For example, just adding mysql-connector-java as a dependency to my plugin increases the file size from just a few kilobytes to 4 megabytes, meanwhile other plugins which support several databases are usually only 1 megabyte
If you have multiple plugins depending on the same thing make some sort of api/library
That it depends on, in the end it does not matter all that much
There is one jdbc driver provided by spigot. There is also the maven shade plugin minimizer and you can even download dependencies on runtime if you really want to.
I actually followed Spigot's tutorial for JDBC when setting it up https://www.spigotmc.org/wiki/connecting-to-databases-mysql/ but when I compiled without shading it, I got errors for all of my usages of JDBC being unrecognised
Also, where can I find that minimiser plugin / how do I use it? I tried searching for it but all I can find is the shade plugin itself
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
nvm just read the section on Driver Implementation, I assume that's why haha
i hate to ask for solutions but does anyone know how to launch a non entity projectile
minimizing is a function of the maven shade plugin
such as an axe
There are multiple solutions. If you are on the latest spigot version then you can just launch a snowball and set its texture to the one of an axe.
public void throwAxe(final Player player) {
final Snowball snowball = player.launchProjectile(Snowball.class);
snowball.setItem(new ItemStack(Material.IRON_AXE));
PersistentDataContainer container = snowball.getPersistentDataContainer();
// You probably want to set some PDC data so you can check for
// that in the ProjectileHitEvent
}
I'm pretty clueless with Maven haha. That makes sense. Thanks! That's reduced the file size to 2.5MB. Still not quite the size other plugins somehow manage but tbf I don't really mind the size, was just curious
anybody know why event just isn't reacting
Waraxe Class:
package me.tapwater.customitems.weapons;
import me.tapwater.customitems.CustomItems;
import me.tapwater.customitems.items.Weapons;
import org.bukkit.Material;
import org.bukkit.entity.Snowball;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.inventory.ItemStack;
public class KratosWaraxe implements Listener {
public void OnUseWaraxe(PlayerInteractEvent event) {
Weapons weapons = new Weapons();
System.out.println("a");
if (CustomItems.Equals(event.getItem(), weapons.KratosWaraxe())) {
final Snowball snowball = event.getPlayer().launchProjectile(Snowball.class);
snowball.setItem(new ItemStack(Material.IRON_AXE));
}
}
}
@EventHandler
damn
i stupid
anyway to set the orientation of the item
so its facing forwards for example
Nope. For that you would have to mount the snowball with an ArmorStand, make both invisible and set the head item to an axe.
This requires NMS. Dont forget to clean up the ArmorStand when the Snowball dies
i've never messed with nms so i'll leave that for now
could this be achieved by moving an armour stand smoothly using entitymoveevent to check for collisions?
but how to make an armorstand's head rotate smoothly rather than 20fps?
No. You could create your own virtual projectile. But then you would need to do the movement and collision detection manually using ray tracing.
How can I rotate armor stand y rotation (pitch) with nms/packets?
I want the y rotation to follow specific player's head rotation.
why with nms?
client side entity
Hey! How could I allow users to use some specific noteblock blockstates to create a beacon?
You mean you want a pyramid of specific noteblock blockstates to enable beacons?
yes
I was told it's really easy with datapacks
And I found some tags in spigot api, but I have no idea how to use them
Uhm. Id have to check at what occasion the beacon checks for the Blocks beneath it.
thank you!
Ok after further investigation this sounds like its either impossible or can only be done through some really nasty hacking.
Im pretty sure that this is not done "really easy with datapacks"
i am not sure but would it be a solution to send packets to change the block to what you want but in reality the blocks are diamond blocks?
guild.getGuildLocation().getBlock().setType(Material.GOLD_BLOCK);
// Sets the blocks manually, because I'm bad in math
guild.getGuildLocation().add(1, 0, 0).getBlock().setType(Material.GOLD_BLOCK);
guild.getGuildLocation().add(0, 0, 1).getBlock().setType(Material.GOLD_BLOCK);
guild.getGuildLocation().subtract(1, 0, 0).getBlock().setType(Material.GOLD_BLOCK);
guild.getGuildLocation().subtract(0, 0, 1).getBlock().setType(Material.GOLD_BLOCK);
guild.getGuildLocation().add(1, 0, 1).getBlock().setType(Material.GOLD_BLOCK);
guild.getGuildLocation().subtract(1, 0, 1).getBlock().setType(Material.GOLD_BLOCK);
guild.getGuildLocation().subtract(1, 0, 0).add(0, 0, 1).getBlock().setType(Material.GOLD_BLOCK);
guild.getGuildLocation().subtract(0, 0, 1).add(1, 0, 0).getBlock().setType(Material.GOLD_BLOCK);
guild.getGuildLocation().add(0, 1, 0).getBlock().setType(Material.BEACON);
Why the block don't set correctly?
Probably because you dont clone the location.
You should also use a for loop for this. Its the perfect use case.
But thanks. I will clone theme
Like this: guild.getGuildLocation().clone().add?
myea
Okay.
but use a loop
Okay. I will try. π«
it is not hard math
You should probably clone the location in your getGuildLocation() method. Dont expose a mutable object like that.
Sorry.
You mean:
public Location getGuildLocation() {
return guildLocation.clone();
}
yea
I have to read what clone() does. xD
Ah
it literally "clones" it π
Thanks.
is there a nms and packets tutorial out there
hey, does anyone know how i could make a user input method ? I can't seem to find any and using protocolLib i get error message java.lang.IllegalArgumentException: Cannot find legacy packet 53
Input method?
yes, means someone inputs text (in a sign, chat or anvil) then i retrieve the message in a string
Bukkit Conversations API
Generally NMS isn't really documented because it constantly changes
On top of being obfuscated
As for packets, you can use NMS's packets and just read into the constructor, along with https://www.wiki.vg/Protocol/
Then using packets with ProtocolLib, decompile NMS's packets and look at the fields
Example:
public class PacketPlayOutSomeExample extends Packet<...> {
private int a;
private boolean b;
public PacketPlayOutSomeExample(Entity entity) {
this.a = entity.getSomeValue();
this.b = entity.getSomeOtherValue();
...
}
...
}
You'd do packet.getIntegers().write(0, someInt); instead of writing an entity
Because that's how ProtocolLib works
o
As for NMS purely
Uhh
Just use a decompiler mostly
It's not that hard to figure out appropriate names for things
Useful stuff is like
To make an entity move somewhere, look into EntityInsentient#getNavigation
there's a method named a(Location, float);
If you decompile it, you can easily figure out it should be called something like moveTo(Location target, float speed);
Among other stuff
Nowadays nms is mostly deobfuscated with mojang's mappings
although you can't really share them
There's also SpecialSource which gives you nice names for NMS and changes them at compile time to their original value
can i get some help with this, i was doing the top thing:
https://paste.md-5.net/uwibatenux.cpp
but then in the interest of making it thread safe i changed to the bottom and now it doesn't work - anyone know why it doesn't work.
My usecase for it is in a pathfinder
so i am getting all the surrounding block "Nodes"
Youβre pathfinding async?
thats the idea π
well - the path is broken up into 50 block Paths
which are then chained together
Can you share more code heh
no stealing lmao
Thing is you have to make some sort of lock mechanism probably which can be somewhat performance taking
Send Dm then if youβre afraid of skidders
ye il shove it in a paste
I steal code all the time
hi
ineed code for 1.8.8 that when player place any thing blocks or fire or water this thing will remove after 5s
no one will spoonfeed
go make it yourself, its simple
make a block place event
then a scheduler
after 100 ticks it gets replaced with air
@grim ice
@EventHandler
public void removeBlock(BlockPlaceEvent event) {
if(event.getBlock() !=null) {
Block block = (Block) event.getBlock();
Bukkit.getScheduler().runTaskLater((Plugin) this, () -> {
block.setType(Material.AIR);
},200L);
}
}
but air not found
Caused by: java.lang.IllegalStateException: Cannot get plugin for class me.tvhee.bedwars.lib.plugin.SimplePlugin from a static initializer (decompiled version) https://paste.md-5.net/eseficoxuw.java, I don't see any static initializers anywhere?
wdym
also 200 ticks are 10 seconds
and why in the world are you doing this in your main class
Itβs coupled with SimplePlugin send that also
Ok
This is non editable for me
I've never had this issue before, and today suddenly I got this error
Yeah so basically
Itβs trying to get your plugin instance before itβs even created
It is since I've added private BedWarsLeaderboard leaderboard
Yes you mean
public static BedWarsLeaderboard getLeaderboard()
{
return ((BedWarsPlugin) SimplePlugin.getInstance()).leaderboard;
}
Yeah well
Then I need to do (outside) SimplePlugin.getInstance()).leaderboard; and create a getter
Ok
If thatβs called statically anywhere in the main plugin class or a super class of the main plugin class then itβs going to fail
Ok, thanks
Why can't I do Class<? extends BedWarsAPIPlugin & T> clazz as method parameter?
How do I add offset to a direction, I have this in a loop
Location loc = player.getLocation();
loc.add(loc.getDirection().multiply(distance))
All this does is obviously move in a straight line, but how can I achieve a zipzag effect relative to the player's direction?
This is the locations I'm getting right now (the dots are location points)
.
.
.
.
I want
.
.
.
.
.
.
Had to do it in type initializer, my foult
yeah
public static <T extends BedWarsAPIPlugin> T getPlugin(Class<T> clazz)
Yeah
As for this
uhhhh
you can zigzag easily
by checking remainders
if it's odd, go right
if not, go left
Check remainder of what?
Like
let's say you want to zigzag 100 times
for(int iteration = 0; iteration < 100; iteration++) {
boolean odd = iteration % 2 == 1;
if(odd)
...
else
...
}
Oh yea, I already know that, but how do I actually add the offset?
I can't just loc.add(offset, ...)
add a constant offset on 1 axis and one alternating offset on the other
It can't be constant, because it needs to be relative to the direction.
cos, sin multiplied by the offset
double offset = 0.5;
Location loc = player.getLocation();
loc.add(loc.getDirection().multiply(distance));
loc.add(Math.cos(offset), 0, Math.sin(offset));
Like this?
oh wait what
Cos sin of what?
the direction
yaw / pitch
I honestly don't know what you're trying to do
other than zigzag
This is the locations I'm getting right now (| and / \ are location points)
|
|
|
|
|
I want
\
/
\
/
The y won't change.
In that case
double radians = Math.toRadians(yaw);
double baseX = Math.sin(radians) * offset * iteration;
double baseZ = Math.cos(radians) * offset * iteration;
Now
You can zigzag the yaw
and add baseX to the location
zigzag
I'm still getting a straight line, but it's not even in the player's direction anymore.
hmm hold on
new BukkitRunnable() {
double distance = 1;
static final double maxDistance = 10;
boolean odd;
@Override
public void run() {
double offset = odd ? 0.5 : -0.5;
odd = !odd;
double radians = Math.toRadians(location.getYaw());
double baseX = Math.sin(radians) * offset * distance;
double baseZ = Math.cos(radians) * offset * distance;
Location loc = location.clone().add(baseX, 0, baseZ);
player.getWorld().spawnParticle(Particle.FLAME, loc, 1, 0,0,0,0);
if (distance++ >= maxDistance) cancel();
}
}.runTaskTimerAsynchronously(plugin, 0L, 1L);
This is just spawning a straight line from two random directions from the player.
Okay
import org.bukkit.Bukkit;
import org.bukkit.conversations.Conversable;
import org.bukkit.conversations.ConversationContext;
import org.bukkit.conversations.FixedSetPrompt;
import org.bukkit.conversations.Prompt;
import fr.pierronus.gcaplugin.GCAPlugin;
public class FirstPrompt extends FixedSetPrompt{
GCAPlugin plugin;
public String s;
@Override
public String getPromptText(ConversationContext arg0) {
System.out.println("What ?");
return "What ?";
}
@Override
public Prompt acceptValidatedInput(ConversationContext context, String s) {
Conversable cpo = context.getForWhom();
System.out.println("acceptVI");
if (s.equals("None")) {
System.out.println("none");
}
if (s.equalsIgnoreCase("1")) {
System.out.println("1");
cpo.sendRawMessage("1");
}
return Prompt.END_OF_CONVERSATION;
}
}
this is my prompt class and the next code is the line that fires (in another class) :
.withLocalEcho(false).buildConversation((Conversable) player).begin();```
problem is, it definitely outputs "What ?" in chat, but no matter what i type it'll still repeat What ?, until i type "depart", even tho i typed that if the sender types 1, sysout 1 and send msg 1
@smoky finch pretty sure you can achieve a zigzag function with a combination of mod and abs and an offset
Try on desmos
y = abs((x % 1) - 0.5)
Y is your left/right offset and x is the iteration aka forward offset
If you want it to be centred around the line x=0 then just subtract 0.25 at the end
To change amplitude multiply all the constants by the amplifier
To change the frequency multiply x by the frequency variable
So full formula would be:
y = a*(abs((x*f % 1) - 0.5) - 0.25)
Hey there π currently working on a plugin witch involve ender dragon, but as you probably know dragons have a « portal locationΒ Β» attribute witch is the location where they will fly around when they are in circling phase for example. Iβm trying to modify this attribute but idk how :/
That is not going to work. What you're doing is a zigzag in a constant direction, I'm trying to do this where the player is looking.
Yeah that is equivalent, just transform it
assume all this math is with yaw 0
There is no absolute directions
then just multiply the result by the cos and sin
It comes down to what you use for your axis
I'm using x and z, but I can't simply just change one of the axis, because it must be relative to the direction
I have to change both axis somehow, that's where I'm stuck
Your x is just the iteration, y is your left/right offset
So multiply the offset with your local right vector
Okay, let's say y = abs((x % 1) - 0.5) y is my offset, how do I actually apply it to the final location?
I'm not sure what you mean by "local right vector"
Is your zigzag flat horizontally
Yep, no y, just x and z
Okay then you can rotate your player's forward vector by 90 degrees around the Y axis
That will give you the local right vector
i hate maths
Then your final location is forward * x + right * y
new BukkitRunnable() {
double distance = 1;
static final double maxDistance = 10;
boolean odd;
@Override
public void run() {
double offset = Math.PI / 2;
if (odd = !odd) offset = -offset;
Vector dir = location.getDirection().rotateAroundY(offset).multiply(distance);
Location loc = location.clone().add(dir);
player.getWorld().spawnParticle(Particle.FLAME, loc, 1,0,0,0,0);
if (distance++ >= maxDistance) cancel();
}
}.runTaskTimerAsynchronously(plugin, 0L, 3L);
Am I doing this right?
if (odd = !odd) offset = -offset; this confuses me but works
x%1 π€
Yeah, that doesn't seem to work either, the same thing is happening <#help-development message>
x*f should be a float so if f is not a whole number it makes sense :)
Idk what the problem is, but the error says: "Cannot resolve symbol 'getConnection'", But in tutorials all ok.