#help-development
1 messages · Page 491 of 1
Anyways creating a new class helped
add please
With his girlfriend.
eclipse is good man
What is eclipse?
An IDE
An IDE?
a type of moon
What is an IDE?
an idea
basically a physical process
Integrated Development Environment. How did you end up here?
ez nuts
What is an Integrated Development Enviornement?
What is love
where one physical body overlaps another
baby dont hurt me
I want this
its where a mommy puts the poopstick in the fathers virgina
Are you five?
it was a joke
Glad to see we are all cultured here.
You scare me
gonna cry
No but seriously why use eclipse when there is a community version of IntelliJ that does everything better ;-;
Show the code
welcome to programming
thats a spigot
we also don't
Spoonfeed a newbie for a day and they'll come back with more questions. Teach them to find their own answers and you'll both be better off: you won't get stuck answering the easy questions and they'll be much more productive than before.
No one knows :(
?nocode
It’s hard to answer a programming question without code
Oh no! You ran into a problem. But no worries, people are willing to help, but first they need to see your code. This is because otherwise, they would be providing help based on guesses instead of concrete knowledge. Whether it be a compile error, runtime error, or an unexpected output, I'm sure that if you were to provide code, you'd receive a quick solution.
it doesnt
Is inventory even serializable? Cause if not, you need to create an inventory then set the contents.
I know location is serializeable
Inventory a = new Bukkit.createInventory(i dont remember);
Look at the javadocs ez pz
cuz array of itemstacks serialization to yaml
youcan save the contents
idk how a yaml would work with that though
as there is no .getInventory for yamlConfiguration lol
You look through the contents
Inventory itself is not serializable
then use a Configuration sections
But a list of items should be
Use ConfigurationSections and then easy peasy
I would just prefer to have a hashmap, print the contents 1 by on onto a txt than read them when needed linep er line
sheeeit
Ah, so yea. You just need to create an inventory instance then.
make sure its a public inventory
show the explosion
make sure to leave a report on JIRA
explosion
who likes trees
binary trees
SortedMap m = Collections.synchronizedSortedMap(new TreeMap(...));
m.addTrees(favoriteTrees("NukerFall"));
no way
i have learned
what
delete them and try again
cool
That would probably explain a lot.
where is the inventories folder mkdir()?
What will Bukkit.getOfflinePlayer(uuid) return if the player has never joined the server?
I probably failed but here is your spoon full of feed
hehe
an offline player
for getOfflinePlayer every player exists
fired
it will just have less actual data
It should.
just null
ah ok, so its just an empty offlineplayer object that contains only the uuid
?jd-s
If the player doesn't exist on the server, it should fetch it from mojang servers and put the temp data in the usercache.json
It’ll make a lookup to Mojang for their name
If it’s null that means no minecraft account with that uuid exists
it can just return null if player like never existed
Ah yea, it actually says in the docs
Player name or null if we have not seen a name for this player yet
thanks
Ah does it not make a lookup
nah lol
!ban
I’m probably thinking of game profile then
Ohh, it does if you use the sting method.
!ban
Description: Ban a member, optional time limit
Cooldown: 3 seconds
Usage:
-ban [user] [limit] [reason]
-ban save [user] [limit] [reason]
-ban noappeal [user] [limit] [reason]
Example:
-ban bean making bugs
-ban save gin 2d needs to calm down
-ban noappeal piguy dont come back
there we go
yup
might want to use exception catcher 3000 on that
my code consists of
ByteArrayDataOutput out = ByteStreams.newDataOutput();
out.writeUTF("ConnectOther");
out.writeUTF(player.getName());
out.writeUTF(args[0]);
// If you don't care about the player
// Player player = Iterables.getFirst(Bukkit.getOnlinePlayers(), null);
// Else, specify them
player.sendPluginMessage(this, "BungeeCord", out.toByteArray());
it's so baddd
So they implemented a web request lookup for name -> UUID but not for UUID -> name ? Thats kinda sad xD But good to know
bungee
That's the spigot jank for you.
if you have a player uuid then probably you got it from an actual Player object somehow
so you know that player existed
unless you just do UUID.randomUUID
for like no real purpose
you could use that to reset the players uuid (plugin specific)
It would be nice if we could have that as an optional parameter.
OfflinePlayer#getOfflinePlayer(UUID uuid, boolean lookup)
I'd rather have the info in the usercache just in case.
i mean is there like any reason to use getOfflinePlayer?
If you want name from uuid you can use a gameprofile
to get his name
Several reasons yes
||a||
inventories/nameoftheplayer.yml
well
its supposed to...
what does that folder look like?
you don't have the folder created in plugin's folder
yah
you need to mkdir() it
or use the file.mkdirs() method and an if check
mega explosion
whats Caused by: org.bukkit.command.CommandException: Unhandled exception executing command 'staff' in plugin Nao v1.0
and even with mkdirs it doesnt appear the folder
whats at OnJoinEvent line 49?
code
event.getPlayer.performCommand("staff");
you load config before making sure that file exists lol
and well, your file doesnt
you don't have createNewFile() and your mkdirs() is running after all of that
4real
and well, this
i thought you need to have createNewFile in case you want to get the YamlConfiguration instance
cool now compile and save your inv
and search for the file
and that works
that hurts
if that file doesnt exist its erroring
if you call loadConfiguration(file) on a non existent file it will error
i rlly dont know how tf it works
i literally said that
hello do u know a plugin to block all command and tab completion in a hub server ?
so
that code
its ok
but the other
one
it isnt
damn
i dont understand anything
thx i will ask in help server sry
do you check if the file exists first
probably
but we don't have a file
ok lemme see if its works
cuz your file creating code is not working
true
well, the folder appears, smth is smth
the file inside?
what in the big actual fuck
oh true
im rlly happy right now
yep
first, go and rewrite your systems to check if the file exists before loading it
then mkdirs the playerdata folder if it doesnt exists on startup
youd better just mkdir all of the folders in onEnable()
this folder is only for staff inventories
yeh
but now
another explosion
maybe in itemstack stuff
what does the staff command do
im taking a wild guess, you are trying to access and args entry
you are getting a command error
bruh is about to get wild
oh right i dont have it on config
what is staff command line 76
^^
check how supervanish or vanish no packet do it
K
I mean, there's Player#hidePlayer() and Player#hideEntity()
for (var p : Bukkit.getOnlinePlayers()) {
if (p.getUniqueId().equals(player.getUniqueId())) continue;
p.hidePlayer(player);
}```
smth like this ig
jd-s at your service
oh
well, i dont need to mess with events?
k then
You technically should be able to compare players with ==
who is getting hidden from who
i would personnaly just have a list copy with that player excluded
so i avoid 99 if checks
idk what's faster
It's hides the player relative to the person you are executing on.
So if Player1#hidePlayer(player2), player 2 will be hidden for player 1.
so my code is right then
What i was thinking to do is to make a static map of UUID and Name and with a event of appearing a entity hide it if it matches with the player in map
But its easier
lol
i could just look at the javadocs tho
thanks anyways
(i will forget it in 10 seconds)
Use the non deprecated one then.
No, it's still #hidePlayer(), you just need to supply a JavaPlugin instance.
k
It’s so multiple plugins hiding and showing players work together properly
ie if 2 plugins hide and then 1 shows again
It should still be hidden because of that other plugin
Oh? Is it like if a single plugin has hidden set to true, all others won't show it until the original plugin allows it, or is there a way to override it?
how can i check if the projectile is a specifig enderpearl
Or compare type
like this?
Oh you want to see if it matches a specific instance?
what in the ginourmous biggo actual fuck 😿
Or is endlessEnderPearl an ItemStack
its a itemstack in endlessenderpearl
He wants to see if the projectile is an enderpearl.
what's wrong
I think you can get the held item for the projectile launch event
index and anotherString dont exist for some reason
how should i get a player from that collection
trueee thx
players.get
Remove those
You don’t specify the argument names
Is that eclipse failing to put the indicator tags or?
im following:
https://www.youtube.com/watch?v=oH0VS2NYSHo
CLICKABLE SIGNS!! Welcome to another Spigot Basics tutorial, today we look at creating Clickable Signs. Enjoy :)
eclipse never had indexes
Oh ok, so just the values
Correct
Could of swore it did.
bruh stop pasting everything you see
well it's turned off for me then
It’s off by default
i just hover my mouse over method name
Idk why
how would i get the player that caused the projectile launch event
to see what i need
get the entity and check if its a player
You can’t
entity would get the projectile
You need the thrower entity
Nuker look
why
why whatt
just... why
you dont even need it
thats what it returns
for (var p : Bukkit.getOnlinePlayers()) {
if (p.getUniqueId().equals(player.getUniqueId())) continue;
p.hidePlayer(player);
}```
look
That would hide every player for everyone.
no
wee
just hide player from every player
i dont think so
Also, isn't that kotlin?
no
its 17
No java has var
Wat?
var is like from java 13
But like, avoid using it
Since when?
Especially in this case
or even before that
Why on earth did var come to Java?
Idk
idk
cuz we are too lazy to type generics
thats the worst datatype i know.
If only your ide could do it for you
i may be dumb rn
Oh wait it can
You need to cast.
Check and cast
But before that, check it.
Shooter may not be a player
your project comp. level is lower than 13
well it works that way
you need to set java version to 17 in pom.xml/ build.gradle
List extends Collection, so you can just use List<Player>
Collection is the generic interface for all collections
learnjava
List, Set, Queue
like this?
Yea
you can just use pattern matching
on newer jdk
if (!(source instanceof Player p)) returnl
Yay pattern matching
Idk if I'll ever get used to that.
Best new feature
i can check if a item has a certain flag cant i
They are used to hide certain stuff in the tooltip
What are you trying to look for on the item?
?di
Guide to dependency injection: https://www.spigotmc.org/wiki/using-dependency-injection/
Umm my Main class is a extention of java plugin
am I able to add that in the Main class before its extended
so i success to disable all command like this.
@EventHandler
public void onPlayerCommandPreprocess(PlayerCommandPreprocessEvent event) {
Player player = event.getPlayer();
if (!player.isOp()) {
event.setCancelled(true);
}
}
but my code for turn off tab completion for no operator user, doen't work, can someone try to explain my error please ?
@EventHandler
public void onTabComplete(TabCompleteEvent event) {
Player player = (Player) event.getSender();
if (!player.isOp()) {
event.setCancelled(true);
}
}
?
it needs an intance
read the link he gave until you understand it
getConfig is not static
I did, i understood that dependencie injection can only happen for a regular class
you don't cancel you return an empty LIst
If you want to remove tab complete
Wipe the command list sent to players in the PlayerCommandSendEvent
Think I got that name right
private FancyLogger logger;
@Override
public void onEnable() {
// pass in the current instance of the class in the constructor of the new class
logger = new FancyLogger(this);
BlockBreakListener listener = new BlockBreakListener(this);
super.getServer().getPluginManager().registerEvents(listener, this);
}
/**
* Returns this plugins fancy logger.
*
* @return the FancyLogger for this instance
*/
public FancyLogger getFancyLogger() {
return logger;
}
}```
It says that this returns the main class
so I can access this, then I can access the config?
yes, so long as you use it in your Listener
you need to access the instance
this just refers to the object you are currently in.
I made my Main class a final class
no point
Ok, so, do I put the code in the same file as my listener? thats what I did
Guide to dependency injection: https://www.spigotmc.org/wiki/using-dependency-injection/
read the dependency injection link, Everything is in there.
i return an empty list but i can still see tab completion on my server
do you mean the command or the arguments?
commands
Spigot needs to annotate stuff with the version it was added
When was that event added
probably when Player#updateCommands() was added
Hey, how can I send people into different servers with a plugin using bungeecord?
Which was when😂
yes 😄
Fr, time to update the docs with a bunch of @since tags.
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
Plugin messaging
Think i got it:
FileConfiguration config = this.getConfig();
public Main(FileConfiguration config) {
this.config = config;
}```
^Main
```FileConfiguration config = new FileConfiguration();```
^Other classs
no
Thank you!
We’ve talked about since tags before
No
But having since tags might make people thing we support those older versions
Time to re-read i guess
So everything is @since latest
You didn't understand a single sentence in the dependency injection
How so?
How? Do people not understand English?
I honestly thought this guy was a troll earlier when he kept messing up his pom.
Use dependency injection to pass main to other stuff
He got there in the end so I'm assuming it's severe case of ADHD
So if you want to create a listener that needs your plugin instance
You use dependency injection
If you then want to use the config in that class, you can do plugin.getConfig
im just dumb..
Thats possible too 🙂
not far off..
Why are you creating a constructor for your main class?
Lmfaooo
So I can pass the config file
config.yml can be accessed via main class
Seriously, how could people misinterpret that tag? The whole point of it is to make it clear that the method only started to exist since the version listed.
Is there a scenario that I'm missing where people would think it means something else? It's also not as if the comment couldn't be elaborated on a little bit more if you wanted to make it crystal clear.
But why do you want to pass the config to your main class?
Your main class already has your config
No I want to pass it to another class
Oh, so i need to flip it
Well it seemed like you intended to
Create a constructor for the class that requires the dependency (config)
If you only support latest then it doesn’t really matter when it was added
It’s in latest
And that’s what you should be using
I guess we should just remove all old spigot versions then since they're not supported
I guess, but does it really hurt to have good documentation? Also, if the latest is the only thing that should be used, why is there so many people still asking for older version support? Why has it not been made clear that older versions should not be used?
And then pass the config when doing new SomeClass(this.getConfig());
It makes sense that older versions are not supported
It’s pretty clear we don’t support older versions
But people are nice and still help
Unlike paper :p
But that doesn't mean you can't document when something was added
Then do you have multiple annotations when somethign changes?
one for when it was first added, another for when it changed
Have any of the methods changed?
Ideally method behavior shouldn't change
I can see the point of a searchable database of changes
thx it's work now !
annotations I can see as being problematic
So you just need a @AddedAt("version") and @ForRemoval("version") for deprecated stuff
Generally changes mean nee methods
You don't even need annotations, just the comment tags.
true
And deprecated stuff is never removed
Unless it’s straight up impossible to keep it then no
FileConfiguration config = this.getConfig();
SignEvents signEvent = new SignEvents(config);```
```public class SignEvents implements Listener {
private FileConfiguration config;
public SignEvents(FileConfiguration config) {
this.config = config;
}
```
Spigot is all about backwards compat
Please tell me im close
No
Config will be null
You need to do in in onEnable
Config is not loaded when the plugin instance is created
its loaded when first accessed
SignEvents class is correct tho
You are
I'm confused. If the latest is the only thing that is supported/matters, then why even worry about backwards compat?
You just need to do your stuff in onEnable@topaz atlas
FileConfiguration config = this.getConfig();
SignEvents signEvent = new SignEvents(config);```
There
thats all
public void onEnable() {
SignEvents signEvent = new SignEvents(this.getConfig());```
Latest is the only supported for new development
But you don’t want old plugins to break
Register signEvent
pass signEvent not new SignEvents()
You already created the new SignEvents and stored it in signEvent
scheduler.run(() -> {
player.setVelocity(location.clone().add(player.getLocation().getDirection().multiply(-2)).toVector().subtract(player.getLocation().toVector()));
});
I have this code that works perfectly on my server (moves the player around the initial location depending on the direction he is looking).
But on someone else's server it doesn't work at all. It teleports the player back and forth and makes a bit of a mess)
my tests gave these results. In both cases I did not move. If everything works, I have to be teleported once to be placed in the right trajectory, then I don't have to move anymore (because I don't change my look)
my server: it works
28.04 01:18:56 [Server] [INFO] [BEmote] [STDOUT] -----------------------
[03:50:24 INFO]: [BEmote] [STDOUT] X: 1,93 Y: 0,21 Z: 0,46 -> your move
[03:50:24 INFO]: [BEmote] [STDOUT] X: 1,93 Y: 0,21 Z: 0,46
[03:50:24 INFO]: [BEmote] [STDOUT] X: -792.6763758631731 Y: 21.0 Z: 1771.232863963201
[03:50:24 INFO]: [BEmote] [STDOUT] X: -792.6763758631731 Y: 21.0 Z: 1771.232863963201 -> your current coordinates
[03:50:24 INFO]: [BEmote] [STDOUT] -----------------------
[03:50:24 INFO]: [BEmote] [STDOUT] -----------------------
[03:50:24 INFO]: [BEmote] [STDOUT] X: 0 Y: 0 Z: 0 -> next move
[03:50:24 INFO]: [BEmote] [STDOUT] X: 1,93 Y: 0,21 Z: 0,46
[03:50:24 INFO]: [BEmote] [STDOUT] X: -792.6763758631731 Y: 21.0 Z: 1771.232863963201
[03:50:24 INFO]: [BEmote] [STDOUT] X: -790.7415008631731 Y: 21.21425 Z: 1771.691238963201 -> moved
[03:50:24 INFO]: [BEmote] [STDOUT] -----------------------
its server: I am not moved the first time, and my move afterwards is not zero
28.04 01:18:56 [Server] [INFO] [BEmote] [STDOUT] -----------------------
28.04 01:18:56 [Server] [INFO] [BEmote] [STDOUT] X: -1.71 Y: 0.1 Z: 1.03 -> your move
28.04 01:18:56 [Server] [INFO] [BEmote] [STDOUT] X: -1.71 Y: 0.1 Z: 1.03
28.04 01:18:56 [Server] [INFO] [BEmote] [STDOUT] X: 0.5130243148498054 Y: 52.0 Z: 463.4330223617531
28.04 01:18:56 [Server] [INFO] [BEmote] [STDOUT] X: 0.5130243148498054 Y: 52.0 Z: 463.4330223617531 -> your current coordinates
28.04 01:18:56 [Server] [INFO] [BEmote] [STDOUT] -----------------------
28.04 01:18:56 [Server] [INFO] [BEmote] [STDOUT] -----------------------
28.04 01:18:56 [Server] [INFO] [BEmote] [STDOUT] X: -1.71 Y: 0.1 Z: 1.03 -> next move
28.04 01:18:56 [Server] [INFO] [BEmote] [STDOUT] X: -1.71 Y: 0.1 Z: 1.03
28.04 01:18:56 [Server] [INFO] [BEmote] [STDOUT] X: 0.5130243148498054 Y: 52.0 Z: 463.4330223617531
28.04 01:18:56 [Server] [INFO] [BEmote] [STDOUT] X: 0.5130243148498054 Y: 52.0 Z: 463.4330223617531 -> you did not move
28.04 01:18:56 [Server] [INFO] [BEmote] [STDOUT] -----------------------
in acf, I want the tab complete for a command to be all the players that are in the party
anyone have an idea? I don't understand it
is there an easy way to do this? and not just have it be every player
we're probably gonna need more code than that
completly weird question but is there a way to stop a enderpearl from being consumed on use without canceling the event?
commandManager.getCommandCompletions().registerCompletion("playersParty", c -> PartyManager..getPlayers("game1"));
and then how do I use that tag in the actual command
is it like @Completion or something like that?
@CommandCompletion("@playersParty")
if you want an example
/**
* Command tag delete
*/
@Syntax("/tag delete <name>")
@Subcommand("delete")
@CommandPermission("tag.delete")
@Description("Deletes a key.")
@CommandCompletion("@tags @empty")
public void onCommandTagDelete(Player sender, String name) {
//Checks if the tag is not registered
if (!TagManager.isRegistered(name)) {
sender.sendMessage(TagNotification.TAG_NOT_REGISTERED.getNotification(new BPlaceHolder("%name%", name)));
return;
}
//Deletes the tag
TagManager.delete(name);
//Messages
sender.sendMessage(TagNotification.TAG_DELETED.getNotification(new BPlaceHolder("%name%", name)));
}
with the c you can get the context of your command (the parameters so you can do whatever you want 🙂
Location location = player.getLocation().clone();
BScheduler.syncScheduler().every(1).run(() ->
player.setVelocity(location.clone().add(player.getLocation().getDirection().multiply(-2)).toVector().subtract(player.getLocation().toVector()));
);```
why wouldn't it teleport them back and forth
oh wait
nevermind i read it wrong
yea I'm pretty confused idk
but uh i think I figured out my thing, thanks for the help @jagged badge
commandManager.getCommandCompletions().registerCompletion("partyPlayers", context -> {
final var player = context.getPlayer();
final var party = partyManager.getPartyWith(player);
if (party == null)
throw new InvalidCommandArgument();
return party.getAllPlayers().stream()
.map(OfflinePlayer::getName)
.toList();
});
yes, that's it, congratulations
i love functional programming
Well you can cancel the event that's called prior which is the PlayerInteractEvent
if we take the problem in 2d, my code takes the initial position, calculates the position on the circle of radius 2 according to the yaw/pitch of the player. Then I calculate the vector between the current position of my player and the position I calculated to push him to this position. But on the second server, it doesn't make sense...
well im curious why you're doing it on every tick
yes me too, but then you want to put it everywhere x) and it's not always very optimized ^^
I want the player to be able to turn around an object with his mouse (no movement on his part, I want him to turn on the sphere of radius 2)
loc.add(direction * - 2).subtract(loc)
so I calculate its position at each tick to move it if necessary
Bruh you're setting his velocity to his look direction * - 2
Which will push the player in the opposite direction they're facing
first vector is
location.clone().add(player.getLocation().getDirection().multiply(-2)).toVector()
it corresponds to the position on the sphere of radius 2 around the initial position
Do you want the player to fly or you want the camera to move
As of they moved their mouse
Ok,that's true
also I don'tt hink you need that clone
I never took the time to check if it created new location or not so when in doubt I always put it x)
Setting the velocity is they wrong thing
You wanna tp the player instead
But in increments
no it will glitched
Basically you wanna lerp it
So small increments
Alternatively, you can probably make the player spectate something and then lerp that
So the client smooths it out
Hein?
??
Yes lerp
Linear Interpolation
Basically if you want the player to look from A to B
You do it in small increments
Lerping isn't the right term
But you can use the concept
but the problem is that on one server it works and on the other it doesn't. Otherwise my thing works the way I want it to. It's already moving the player a little bit at a time
I mean, you could lerp if you were wanting to smooth it out.
if I teleport the player every tick, it will block his yaw/pitch, the player won't be able to look in another direction for me to move him
with small move or not
doing it every tick wont look smooth probably
this has me thinking
is it possible to spectate an item display?
are you able to spectate any entity?
Should be able to
Player#setSpectatorTarget(Entity entity) exists, but it only works if the player is already in spectator mode.
Display entities have no hitbox so I don’t think you can manually spectate them
Is the hitbox a requirement for spectating?
manually spectating yes
but I was just curious if you could force it to happen
im thinking you could turn on display lerping
and have them spectate an empty display
and it would look nice
but idk
Do the display entities not get a UUID assigned to them? I thought you could remove them with the /kill command.
i understand now
they do you definitely can
Odd, I'm not getting an option to do so.
It looks like you can spectate the display entities though.
At least with the vanilla commands.
So it should be possible with the api.
the problem is that they have no hitbox
so you can't look at them and hit tab and have it autofill their uuid
so you'd have to use some other command to get it
It's working for me.
The UUIDs are an issue though.
I had to use the limit selector.
yes
/spectate @e[type=minecraft:text_display,limit=1]
You could probably do a range as well
im sure there's some command that can tell you the uuid of entities near you
It should be significantly easier with actual code though since you can just call Entity#getUniqueId()
Probably the data command.
Omg these things are so simple and im so dumb, sorry, im not used to this. Thanks.
Idk why the distance flag doesn't work properly, but if you find a way to get it to work, you can be more precise, /data get entity @e[type=minecraft:text_display,limit=1]
Should just be distance =..x
what did you do for range
Where x is the number
distance=10
you have to do ..x to specify up to x
That's what I did
I think you got that backwards.
reread my message
distance=10 --> the distance of the entity is 10.0 exactly blocks away from you
Wat?
distance=..10 --> the distance of the entity is 10.0 or less blocks away from you
Is that the new way to do range?
I would have never guessed that.
no its a little weird
Is it specifically 2 dots or does 1 dot do anything different?
useful once you get used to it
1 dot is a decimal place
you can do ranges
2..10
for example
its interesting
Idk why they didn't just use the - sign. It's not like you can have a negative distance.
because they're used in other places to
its a way to do ranges in selectors
distance is just a common place to make use of it
and .. is taken from programming languages that use it
In v1.12.2, before BlockData
How to set a block to, for example, Black Concrete?
Because there is only Material.CONCRETE available. And I don't see Concrete extends MaterialData
somewhat common range notation
What's the replacement for
Black is uhh
What programming languages use that notation? Cause .. has different uses even in operating systems.
here's rust
new HoverEffect(HoverType, BaseComponent)
ones with ranges built in
and don't use them as fucking std::iota
hate c++
The non-deprecated one
But how to set it?
Can you list a specific one, cause the ones in my head that I'm thinking of don't use that notation.
i just did?
Oh, I see the screenshot.
.
hahaha
it might just be rust actually
i can't find any others 😅
but the notation is at least preexisting
confirmed
IIRC, there is a parameter you can use on ItemStack that lets you set a byte value.
looks like haskell has something pretty similar
For blocks I think it was like
You talking about FileConfigurationOptions#copyDefaults()?
There's something you need to enable
May you give me an example, please?
The defaults system is cursed
Facts
What exactly do you want to do
I just want to be able to use
That's why I don't ever use it. lol
Same
If you want defaults, ship a default file
It'll make your life so much easier.
That's not what addDefaults is for... Adding a value if it isn't there
And not override anything
That’s just (!isSet) {
set
}
I thought add defaults added some invisible default values that would be returned if you tried to get() a path that didn’t exist
Idk like I said I’ve never used them
Hmm
no
AddDefault copies to the file
A default value
addDefault doenst copy by defauly
Wut
by default calling addDefault wont copy anything, you have to config.options().copyDefaults(true) and that only works if the config doesnt exist iirc
if you addDefault and save the config those defaults will not be put in the saved config.
That's what it was
That's what I was asking for
config.options.copyDefaults(true)
yes, copyDefaults(true) will replace any missing sections so you can save
Set copydefualts after saveDefaultConfig
saveDefaultConfig()
copyDefaults(true)
#addDefault()
Yes
Not sure abt the saving
well no
if you saveDefaultConfig teh config from yoru jar is saved, IF no config already exists.
Yes
And then
copyDefaults(true) + config.addDefault(val)
Will write to the file
No it wont.
It will write to the cached version. At least it should if is using MemorySection.
so what would be better is getConfig().setDefaults(ne FileConfiguration(...getResource(path)
then config.save
oh copyuDefaults(true) after setting defaults
thats why we use a pre made config updater
Probably some extended method from another class.
What would it do
he probably means saveConfig()
Oh, well it takes the cached config and writes it to disk.
By using that method.
Are you using the default config?
Yes
Then you can just call JavaPlugin#saveConfig()
Otherwise if you were dealing with normal FileConfigurations, you'd have to call FileConfiguration#save()
Is there some way to access the shearing loot tables for an entity to so that I can generate the loot?
saveDefaultConfig();
getConfig().options().copyDefaults(true);
//Whatever you want with getConfig.addDefault();
this.saveConfig();
Like a charm
Are discord threads stored permanently? Or do they dissapear after some time.
They get closed, but they can be reponeded
They're just there forever until they're deleted like a channel is, but they can also be deleted by the person who created them
In v1.12.2, why is this deprecated as Magic value?
/**
* @param type the type
* @param data the raw data value
* @deprecated Magic value
*/
@Deprecated
public MaterialData(final Material type, final byte data) {
this(type.getId(), data);
}
It's deprecated in 1.13+ because items now use namespaces.
Why shouldn't I set the data?
hope they stay 🙂
Ahh
You can ignore that warning if you are using 1.12 or below.
OK thank you
Threads are 2 weeks by default I believe
Three days unless you change it and there might be a server setting to change it to two weeks automatically
Until they get archived
But they stay archived and don’t get deleted as long as the channel doesn’t
I remember trying to load an archived thread and it taking 15+ minutes to load the content.
A discord employee has to manually go get the tape and load it into the system
Hey, I'm trying to outline(aka glow?) a block, exactly how you could do it for entities starting from version 1.16 I guess... Since you can't outline a block, it has to be an entity, I decided to spawn the falling block of the block that I'm looking at for the sake of the test and:
- Make it invisible
- Make it not affected by gravity
- Make it have an outline
I tried searching in forums, including spigot and each have different answers with different ways that are not working/not what I wanted.
However I'm getting this result, in the video below, I provide the code I used in the thread as well. I would appreciate any help. I'm using NMS 1.19.4 as well.
1.19.4 it should be easy with a display entity
Or an interaction entity
Before that I think shulkers were a common method
1.19.4 BlockDisplay has #setGlowColorOverride(). Absolute chad method that exists.
Indeed, 1.19.4 may have display entities but 1.19 doesn't, which that's why I decided to achieve it using this way
I think one method people used was using shulkers since they fit the block perfectly and set their color using the scoreboard teams.
I also heard of shulker method, but the scoreboard is new.
How can I achieve something like for example the higher the player balance is, the chances of creeper spawned near them is lower. So initially, the player will start with $1000, and the chance of creeper being spawned on them every hour is 50%, if player has higher balance, the chances will be lower, how can I achieve something like that?
Sorry if it's hard to understand, i'm struggling finding the right sentences.
You could try referencing this. https://github.com/corentingosselin/ProdigyXray/blob/master/src/fr/cocoraid/prodigyxray/Xray.java
It does use protocol lib, but if you just take the packet names from the classes you should be fine. You may also want to double check they are the right packets since this was last updated for 1.15.
It looks like it uses armorstand packets as well as falling blocks.
The only thing you can really do for spawning is either
- make your own entire custom spawning system
- cancel/replace spawn events
Thank you, will check it out!
Could you leverage the local difficulty by any chance?
public void onClick(PlayerInteractEvent event) {
if (event.getItem() != null) {
if (Objects.requireNonNull(Objects.requireNonNull(event.getItem()).getItemMeta()).getDisplayName().equals(ChatColor.RED + String.valueOf(ChatColor.BOLD) + "Server Selector")) {
event.getPlayer().performCommand("serverselector");
}
}
}```
I really dont know what's happening
supposed to bring up a gui
it is a bungeecoord command if that matters
okayyeah it prob does but how can I get passed that?
event.getPlayer().performCommand("serverselector"); does not go through bungee
than what do I do?
you can not issue commands for bungee through that API
performCommand
there is no method
you obviously have a plugin running on Spigot so why are you tryign to issue a command to bungee?
the bungeecoord has a special api with ability to create GUIS
that api needs to be accessedin offline mode
so no mysqy
api offline? what?
the plugin is not offline but it works perfeclty fine
this is the gui coded in bungeecoord
?pmc
pmc has built in methods for gettign server lists and switching servers
i said im already using pmc
nowhere that I saw
!
thats not even english
yeah I corrected the "use"
gettign
is there a way I can do a shaped gui?
yes that teh was intentional 🙂
teh heh
shaped GUI? datapacks
not sure what you mean by "shaped" then
thats not helpful./.

um, it's what you asked for, no?
declaration: package: org.bukkit.inventory, class: ShapedRecipe
this but for inventorys
recipes are not inventories
omg
yup
the matrix is, kinda
im saying like similar
I'm clearly not understanding the "similar" part
It’s possible. It’s been done in a few of the countless inventory frameworks that exist.
you want a recipe you can push to an inventory?
It’s just a larger matrix. You need a chat array and to map the chats to the items.
Char*
YES a char array
but shadow do you agree with elgar that you cant execute bungeecoord commands with any spigot api?
so just char[][]
Yes. That’s what the messaging channel is for.
so use dispatch command?
It’s whatever the same system is for shaped recipes, just a larger matrix that fits the size of an inventory.
You obv have to make it yourself, but it’s more than possible.
It’s already been done before.
can I see?
Again, just look up some of the inventory frameworks on spigot. A couple of them have it.
char[][] matrix = {
{x,x,x,o,o,o,x,x,x},
{x,x,x,o,o,o,x,x,x},
{x,x,x,o,o,o,x,x,x},
{x,x,x,o,o,o,x,x,x} };```
I just can’t remember the names of them right now.
protolizer
ty
!
you don;t use a matrix there
its for the 9x4 gui
idk why he put the o's but its fine
I dont see any reason to continue working in bungeecoord
ill just delete that mess
it took me 3 days to finally make chatgpt give me the right math for
a 3d Ellipsoid
i really wish to learn the math that i need for that stuff
oh if I'd have realized I have code to do that 😦
well actually to draw an elipse perimiter with particles
adding a 3rd dimension would be easy
public static void generateEllipsoid(World world, Location center, int width1, int width2, int depth, Material material, double theta, double phi) {
int a = width1 / 2; // horizontal radius
int b = width2 / 2; // vertical radius
int c = depth / 2; // depth radius
// Adjust loop limits to add more space
int xMin = -a - 5;
int xMax = a + 5;
int yMin = -b - 5;
int yMax = b + 5;
int zMin = -c - 5;
int zMax = c + 5;
for (int x = xMin; x <= xMax; x++) {
for (int y = yMin; y <= yMax; y++) {
for (int z = zMin; z <= zMax; z++) {
double x1 = x;
double y1 = y * Math.cos(theta) - z * Math.sin(theta);
double z1 = y * Math.sin(theta) + z * Math.cos(theta);
double x2 = x1 * Math.cos(phi) - z1 * Math.sin(phi);
double y2 = y1;
double z2 = x1 * Math.sin(phi) + z1 * Math.cos(phi);
double distance = (x2 / a) * (x2 / a) + (y2 / b) * (y2 / b) + (z2 / c) * (z2 / c);
if (distance <= 1) {
Location loc = center.clone().add(x, y, z);
world.getBlockAt(loc).setType(material);
}
}
}
}
}
(x^2/a^2) + (y^2/b^2) + (z^2/c^2) = 1
where x, y, and z are the coordinates of a point on the surface of the ellipsoid.
To rotate the ellipsoid, you can apply a transformation matrix to the coordinates (x, y, z) before plugging them into the equation. The matrix depends on the angles of rotation (theta and phi) and can be written as:
[ cos(theta)*cos(phi), -sin(phi), sin(theta)*cos(phi) ]
[ cos(theta)*sin(phi), cos(phi), sin(theta)*sin(phi) ]
[ -sin(theta), 0, cos(theta) ]
Multiplying this matrix by the column vector (x, y, z) gives you the rotated coordinates (x', y', z'):
[ x' ] [ cos(theta)*cos(phi), -sin(phi), sin(theta)*cos(phi) ] [ x ]
[ y' ] = [ cos(theta)*sin(phi), cos(phi), sin(theta)*sin(phi) ] * [ y ]
[ z' ] [ -sin(theta), 0, cos(theta) ] [ z ]
Then you can plug x', y', and z' into the equation for the ellipsoid to get the rotated surface.
chatgpt made it for me and i can't do math
nice
it's going to take all our jobs
you seen that YT vid where the guy gets it to write an angry birds game?
the best thing ever, if someone can help you doing something complex is better
yeah, except you need money for leisure
