#help-development
1 messages · Page 1975 of 1
C:\Program Files is not recognized
as an internal or external command
operable program or batch file
that is always nice
"C:\Program Files\Java\jdk1.8.0_291\bin\java" -jar BuildTools.jar --rev 1.16.5
ok
do i remove spigot-api and replace with spigot
Yes
or do i have both of them
Replace
ok
I am making an Spigot Plugin for Minecraft 1.18.1 and everything works just fine. But if i want to use ChatMessageType intellij cannot find it. Somebody has an idea wat i can do?
import the correct library
heey trying to understand what registering an event means.
I tried to search on google but the only results I got where about "how" to register events.
I, on the other hand, would like to know what it means to register an event and what it does.
It means your event handler method will be called when the event is triggered
import net.md_5.bungee.api.ChatMessageType;
Does not work either
are you sure that is what you are trying to do?
ooh is it to lower load on the server?
so that it only listens for events that have been specified and not all possible events?
No it listens to all of them
But the server needs to know where your handler method is, which is why you need to register it
ah ok
I want do set the actionbar of an player. And everybody on the Internet does it like this.
player.spigot().sendMessage(ChatMessageType.ACTION_BAR, "asd");
did you look to see what that import actually gives you?
that specific import only gives you the placement location, it does not give you the sendMessage()
This is not my Problem. The only thing missing is the ChatMessageType.ACTION_BAR
if it is not importing it, you are missing it as a resource/dependancy
Sounds logical. But where i can Download the dependency?
what repositories do you have currently?
It should be part of the spigot API
I thought so too
// maven { url = 'https://oss.sonatype.org/content/repositories/snapshots' }
// maven { url = 'https://oss.sonatype.org/content/repositories/central' }
I believe it is part of one of those two for bungee
I´ll try
What event is triggered when a player breaks a lead?
Events I tried
EntityUnleashEvent
EntityDamageByEntityEvent
PlayerUnleashEntityEvent
is there a resource somewhere about custom events?
some who use eclipse ide, know why i getting those declarations problem? that no make sense
your package thing doesnt have .src in it
i ill delete that f project
my computer dont load intellij ide
what
you specified a binary and it wanted source
my computer is very bad, and it does not meet the minimum requirements, it causes it to crash a lot
eclipse looks like some 50 years old program
are you sure?
its pretty common when using closed libraries, but that is what I recall that error meaning
Looks like your src folder isn’t a source folder
hmm, i thought the note on those two url was in the tutorials
i am sorry
Find paperspigot plugins?
my server is PaperSpigot
and I can't find the page or I don't know if it's here..
can someone explain me what paperspigot is?
it does not exist anymore
It used to be what we refer as to paper
Technically speaking if you are using that name you are referencing an age old unsupported non-spigot server jar, which creates a lot of issues
are there any classes that are damageables but not livingentities
Spigot 1.8 plugins should run on paper
would it be a good idea to hold all my lore lists for guis in a enum?
how would I repeat a block of code infinitely
old name of paper
^ trying to make an item generator
usually while (true), but in a minecraft context thats a big no-no; use the scheduler (Bukkit::getScheduler)
alr, ty
There are two Damageable interfaces.
But if you are speaking of org.bukkit.entity.Damageable then
the only class that is not a LivingEntity is EnderDragonPart
Are boats not damagable
nope
ItemSpawnEvent
https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/entity/PlayerLeashEntityEvent.html isCancelled() would be possibly what you want
you'll need to listen to ItemSpawnEvent if you want to get the leash that was broken
We should get an event for that
I always get dropped leads like this iirc
private EntityUnleashEvent lastUnleashEvent = null;
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onUnleash(EntityUnleashEvent event) {
lastUnleashEvent = event;
}
@EventHandler
public void onLeashDrop(ItemSpawnEvent event) {
if(lastUnleashEvent == null) return;
Item droppedLeash = event.getEntity();
// Do something with the leash, or cancel the spawn event, or whatever
lastUnleashEvent = null;
}
not 100% sure though, maybe I also used a List, Map, or whatever instead. but this should work I guess
yeah sth like LeashDropEvent that extends ItemSpawnEvent and has the unleash event as field/getter
How would I be able to get players current chunk?
getLocation().getChunk()? lol
getLocation.getChunk
Player#getChunk() ?
Is there a shortcut like that?
Maybe its from paper...
not in spigot
i see
Thanks you my brudda
You are mucho helpful
I am aware of that, however in what other case would isCancelled() be called other than the leash breaking or being transferred from the player to a fence?
is it possible to get what is attatched to a leash hitch?
isCancelled is generally set by other plugins
I know that you can get it from a mob but is there a way to get it from a LeashHitch Entity
dam okay
maybe using NMS
I got it working, I just checked the area around the lead
isCancelled() is not setable, it is a state query
setCancelled
Is there a way to prevent there being "phantom leads" when the mob is invisible?
what do you mean by phantom leads?
do you see the lead going diagonal? thats not a real lead
it was generated by the game, and that only happens when the mobs are invis
you might want to kill all leads and then redo it
I've tried that, however each time I place them again they come back, only time they dont is when the mob isn't invis
Did you try restaring your game?
aren't leashes 100% client sided?
it makes no sense for them to exist on the server since they neither have any collisions nor other behaviour
yeah
seems like a lot more work than retexturing chain
I think there's only this packet that tells the player to which entity an entity is leashed to
the leash itself probably doesn't really exist anywhere on the server. after all, what would it be? there's no EntityType.LEASH or similar
I can see the leash texture when my friends have them connected to animals
of course you can. because the server sent you a packet "your friend vladimir is attached to sheep # 1337"
declaration: package: org.bukkit.entity, interface: LeashHitch
:)
that's
the leash hitch
not the leash
the leash does not exist
Oh you mean the line only
the leash hitch is the "knot" on a fence
yes they are talking about the "line" I guess
Yeah that makes sense
leash is a legacy material -> BlockData
Yeah the line is client side
Make sure you're not using Optifine or anything like it
yeah, that's the item in your inventory
which is now called LEAD
Optifine loves to break stuff
tbh leads are broken even in vanilla
ever leashed an animal, came back 2 days later and the lead was "gone", but when you killed the animal, it dropped the lead?
No
well it happened to me all the time
But I don’t really use leads for more than transport
but maybe that was because I was always sing optifine
Is posible to have a protected constructor and public on a final class?
Sorry for the noob question
sure
protected? Why
why should that not be possible
Because im using Builder pattern
on final class, it is, eh, pointless
Not quite. You still have package visibility
But other than that its really weird
and final because i dont want people to create implementations
jusr leave ir without access modifier
I always forget you can do that
What?
Leave stuff with no access modifier
Is the builder a nested class?
Yeah
Leaving things without access modifiers always feels so wrong
^
why not just make it protected
Pointless symbols
public class Test {
private final String name;
protected Test(String name) {
this.name=name;
}
public TestBuilder builder() {
return new TestBuilder();
}
public static class TestBuilder {
private String name;
public TestBuilder setName(String name) {
this.name = name;
return this;
}
public Test build() {
return new Test(name);
}
}
}
Works fine although it's ugly
Then you can make the constructor even private
true
Oh yeah
but since the class is final anyway, it doesn't matter
a final class is simply a class that can't be extended
how can i enumerate this kind of for loop? for (UUID uuid : cInter.coinflipWagers.keySet()) {
What do you mean
by doing what you sent?
Why that names ?
in python there's a function called enumerate that lets you loop through a list of values while also having a variable that keeps the index of the loop
what even is coinflipWagers?
for (a = 0; a < yourList.length(); a++) {
}
??
Isnt That ?
variable instance of a hashmap
a HashMap doesn't have any "index"
it keeps (Player making a wager's uuid, wager amount)
it only has a key <> pair
A map has no indices anyways
and for that, you want to loop over the EntrySet, not the keyset
that's exactly my point
loop over the entryset
HashMap<String,Integer> map = new HashMap<>();
for(Map.Entry<String,Integer> entry : map.entrySet()) {
String name = entry.getKey();
int value = entry.getValue();
}
this is what you mean right?
Map<String, String> someData = new HashMap<>();
public void mapForEach() {
someData.forEach((key, value) -> {
});
}
public void entryForEach() {
someData.entrySet().forEach(entry -> {
String key = entry.getKey();
String value = entry.getValue();
});
}
no yall
Quick question when you make a explosion using .createExplosion() is that explosion an entity?
No
i just wanna show a counter
Explosions are not an entity
you must count yourself
what are they?
because as said, a hashmap doesn't have any order like "give me the 2nd element"
nothing
They are a point in space that goes boom
explosions are not a deterministic object. They are just a set of functionalities.
Map<String, String> map = Maps.newHashMap<>();
map.forEach((key, value) -> {
System.out.println("Hashmap key " + key + " has value " + value);
});
We know right
he wants to do this:
int currentIndex = 0;
for(Map.Entry<String,Integer> entry : map.entrySet()) {
currentIndex++;
System.out.println(currentIndex);
}
I know left
map.entrySet().forEach kekw
few months ago people were always like "why don't you just use normal for loops instead of lambdas / function stuff bla bla" and now everyone's doing the opposite lol
how do I tell if an Entity was damaged by an explosion from .createExplosion()
few months ago oh
anyway if someone doesn't know how to implement a counter, they probably should not be recommended to use lambdas
they won't understand what they are I guess
lamdas would be tricky here as you cant just increment an integer from outside the lambdas scope.
You would need an AtomicInteger for that
I have another question, i have a custom item object (save name, colored name and itemstack), a repository manager (which save each custom object). I want to know how i check if exists an object from name that its return on an event. Because my system its broken caused using item name with colors
Not really possible unless you are creating the explosions yourself.
You shouldnt rely on item display name as identity
declaration: package: org.bukkit.event.entity, class: EntityDamageEvent, enum: DamageCause
just check for Block_Explosion or Entity_Explosion in the entitydamageevent?
Oh so what i can do ?
Use pdc instead
Pdc doesnt exists on my version
L
Sure you can detect when it happens. But sadly not which block caused this.
Use an NBT API or whatever
L
oh didn't see they asked for that
oh NBT allright
idk
You would have to save the location of the explosion and then listen for damage events nearby
NBT its to sign items right?
wow your version must be ancient lol
oof
could also be 1.14.0 lol
Who the heck runs 1.14.0
How you know?
Wht did i tgink about minecraft pocket edition lol
all versions older than a year are quite stupid to use imho
Psychic powers
Download minecraft PE 0.13.0, 1.14.0, 0.15.0, 0.16.0
Why the heck you can download minecraft PE that would design for cellphone on pc?
thx that works
if you need more help with events you can execute the command:
?jd
And there you will find all the documentation
how the heck do you code plugins in basic? is there a basic<>java transpiler lol
lul
bruh
Uh hey alex 😄
"Basic" okay, basic skills
but then
"Basic, Javascript"
ugh
I know, it's so weirdly worded lol
heyhoo
all i want to know is how to add an object variable to an arraylist<Class> (class = a class i made, not java.lang.class) without casting
if you have an ArrayList<YourClass>, the list can, obviously, only contains objects extending or implementing YourClass.class
Could anyone please look for Tag.SIGNS in 1.18.1 spigot api? i just have access to some tags, many are missing for me
You can also do ? Extends your class
that's the whole point of inheritance, objects, generics etc
yeah but he wants to add something totally different to it, we already had this a few hours ago
oh so i will make my class implement arraylist
he was casting ArrayLists to Menu (custom class), casting ItemStacks to Player, etc
what are the benefits of using that over java HashMap<K, V> hm = ... for(K key : hm.keySet()) { V value = hm.get(key); ... }
Pls dont
you don't have to look through the map for the object everytime
?learnjava
Here are some links to get you started on learning Java:
- https://www.codecademy.com/learn/learn-java
- https://www.sololearn.com/learning/1068
- https://www.learnjavaonline.org/
- https://programmingbydoing.com/
- https://docs.oracle.com/javase/tutorial/java/index.html
The last one is the only official one, however some of those concepts assume that you already know a bit about programming.
oh, I see
declaration: package: org.bukkit, interface: Tag
what's the problem with that?
then how do i find a solution to my question
I already told you: learn java
Isnt possible to have something like this??
public abstract class MyClass {
public abstract List<String> getList();
public abstract List<String> getList() default Lists.emptyList();
}
and i will keep doing it
is that decompiled spigot/bukkit?
yeah so we'll ignore you from now on too
Looks like it
have a nice day and go ask on some other discord if you don'T want help
We need a bit more lowdown on that.
So you have an object of type Object
And you have a List<T> where T is your own class.
And you want to know how to add this object to the List?
yes
Hello !
i'm new to plugin developpement and i'm trying to implement an API
on my bungeecord 1.18.1 plugin
https://www.spigotmc.org/wiki/minecord-wiki-api/
that is the documentation
i can't get the Player object and Member Object that the link function require i'm in the onConnect Listener
and i can't do the getServer()
thanks !
noone can tell you how to drive a car if you don't even know what a wheel/tyre is
That’s the spiny thing
You need to cast the object to T
That touch road
This is why i often get mad
but then i get a console error where it is not compatible with arraylist
here let me show u
But you can only cast it safely if you checked its type with instanceof first
ok
?paste
his object isn't of that type, it's something totally different. has no basic knowledge at all, he was casting ItemStacks to Player beforehand. Let me search for his code
@sterile token
Are you telling me itemstacks aren’t players
Wait ItemStacks != Player
^
Did you just assume an objects type? Triggered.
ah found the problem, my editor is kind of confused...
alex there is no solution right?
just make getList() not abstract and return an empty list
Possible?
Yes
Abstract classes can have non abstract methods
Alright. So your object is of type ArrayList but you are trying to cast it to a Menu.
Pretty self explanatory. Dont cast an object to a type it is not compatible with.
public abstract class Test {
public List<String> getList() {
return new ArrayList<>();
}
}
i will try with list instead of arraylist
public abstract class Test {
public List<String> getList() {
return new ArrayList<>();
}
public class SubTest extends Test {
@Override
public List<String> getList() {
return someOtherList;
}
}
}
this is what you want to do, right?
Show your code pls. You can not randomly cast objects around.
I quoted their code here
Ah i see.
oh wait, that's not the class where they are casting the list to menu though
thats a different piece of code
yeah but it shows us that your Menu class does not extend ArrayList, hence you can't cast it to arraylist
What do you think?
so i will make it extend arraylist
easy
No please.
Not easy
Ez clap
the dude is obviously trolling and even said they will keep ignoring all the "learn basic java" suggestions lol
all they want is someone to fix their class without understanding how java even works
https://paste.md-5.net/maxujizeko.java here 7smile
Gets class cast exception -> Simply extends the class and so he can cast anyways
as said, he also casted an ItemStack to player so he can use getDisplayName() on it
the Chad java dev move
yeah you know how long that takes, its such a small question, not even an error
Alright what method throws the exception
god I'm just gonna cast my String to an int
onEnable
but what even is your question
Int integer = Integer.parseInt("10");
works in C, I guess
That best way to declare an int
no
int n = (int) "Hello World";
what if i want to cast "ur mom" to an integer? oh woops.... integer overflow exception....
shut the up
For casting string that contains int, i use that
String -> int
Object obj = config.getList("Menus", menus);
MagnificentMenus.menus = new ArrayList<>(Arrays.asList(obj);
should be
List<Menu> loadedMenus = (List<Menu>) config.getList("Menus", menus);
MagnificentMenus.menus.addAll(loadedMenus);
thanks for actually helping
not a runnable 😡
Are you okaY!!
but you can't just cast a ConfigurationSection to a list
Are you doing your own menu system?
getList isn’t a section
i am trying
you can even pass a type to getList to skip the cast
yeah but his config isn't a list at "Menus"
Ah
This will only work if you saved your menues before using:
config.set("Menus", MagnificentMenus.menus);
and if the Menu class properly implements Serializable.
ConfigurationSerializable*
^ yes that one
this is the original code they want to use
https://bukkit.org/threads/icon-menu.108342/
and now they want to magically cast a configurationsection to a List<Menu>
🤷
Maybe they can do some bytecode manipulation and let ConfigurationSection extend ArrayList<Menu>
then casting will work
that's a good idea!
It’s the material enum all over again
bruh
@quaint mantle https://www.youtube.com/watch?v=xk4_1vDrzzo
yeah that triggers him for some reason
it triggers me too
btw what is the thread even about? "With the new ability to rename items" I am pretty sure anvils were added before 2012
it triggers everyone
ELEVEN HOURS
because you have no idea what you are doing and don't want to learn java at all
cool
that's not even half a day
dude, if you want to make it in software engineering, i recommend actually taking the initiative to learn shit instead of going to the first discord server you find to ask for help on 'boilerplate' issues. theres plenty of resources online
i already do freelance developing for haxe lmao
yeah and i dont want to, i just wanna get this plugin done and ill never touch it again
since it has taken so long
i only do that if i enjoy what i am doing
i dont enjoy java
in fact i hate it
i just want this plugin done and out of my life
then dont come here asking us for help on common issues for like 3 hours
Just pay someone for it then
no one is forcing you to answer
its called a question for a reason
thats true
did you read the channel's topic though?
but would you like to be ignored
turn light mode off
bro still thinks im trolling lmao
anyways good luck with your plugin ima go sleep
don't wanna learn java and spigot = not "serious" development
Help I want to do the thing without actually doing the thing
Me too
Me three
I can't find the fortune enchantment in the Enchantment enum
meta.addEnchant(Enchantment.FORTUNE, 100); // something like this
I'm guessing it's under a different name??
LOOT_BONUS_BLOCKS iirc
yes
Or you can use the namespaced key and getByKey
oh ty :)
dude I could see the list of enchantment... just didn't know which one it was and there's a lot of them
it's quicker just to ask here
Anyone know why this might not be working? Im not getting any errors when I click it, but nothing happens.
Main:
GUI Creator
np
ive been staring at it for the past 20 mins lol
next time just print debug information after every if, then you see where it stops executing
good idea
How would you update a player in the DedicatedPlayerList?
Probably a bunch of reflection
what exactly do you want to do
I tried looking in the source code and I cant exactly seem to find where they add the data
Check if a player is clicking on a far player
I updated the uuid field in the player's Entity class so I want to update them in the player list
can't you just get the PlayerList#playersByUUID field and change the UUIDs there?
actually I don't see any problem there
Field field = PlayerList.class.getDeclaredField("playersByUUID");
field.secAccessible(true);
Map<UUID, ServerPlayer> map = (cast...) field.get(yourDedicatedServerListObject);
map.put(newUuid,map.get(oldUuid));
map.remove(oldUuid);
sth like this
what is an iiod
typo for uuid
oh
International infested octopus donkey
oh yea
forgot about that one
every player has its own international infested octopus donkey
To pay respects
I'll try that, thanks
what are you going to use it for though?
this will probably break like... everything
a character save system
where players can save all plugin data to different characters
i geniunely thought it was something tho
instead of their original uuid
but how are you going to load it when they join?
when a player joins, they'll have their original UUID so their normal stats/inv/etc get loaded
then when they leave, it will save their data in the "new" uuid
Would that be blocked by mojang auth?
No idea
I don't think this is a good idea at all
yeah the idea is interesting 😄
but it will either break so many things, or be so complicated to do without breaking anything, that you could just instead do a character save system using API instead
I'm just too lazy to go in all of my 60 plugins and manually change their data storage tbh
I mean
Generating a random uuid has a super low chance of conflicting
But it could still happen
true
but you do need another data storage to store the fake uuids of a player
then
yeah but anyway I doubt you can get this working
then why not just use that to store the data itself
the first time you get a player object is in PlayerJoinEvent i guess
and there it's already too late
I'm just using a mysql database
you can intercept packets
through netty channel pipelines
yeah but you won't have a serverplayer at that part then
and you need a serverplayer to change the map
after starting handshake packet
because most plugins save data to the players uuids and making all of my plugins save data properly would be really tedious
you assign the uuid
ah
but then it'll will fail online mode thing
I'd rather do an API plugin that maps original UUID to changed UUID and then yeah, change all your other plugins
that's at least the correct way to do it 😛
You’d have to have all custom plugins for that tho
can anyone recommend a good library/tool for large scale Bukkit plugin translations?
Let me find the link
Go ahead
hello gus i need developer
?services
If you wish to request or offer development/art/building/administration services, please do so at https://www.spigotmc.org/forums/services-recruitment-v2.54/
Those who are interested contact me
Chck dm
localization can go so deep I am not sure where to stop 😄 like plural/non-plural, feminine forms etc.
Hypixel has pretty nice and complex localization. State of the art, I think
and then you have to think of a smart way to do all that without trashing the codebase too much
I just reference everything as a key in the codebase
And then pass said key through a language system to get the output
one of my pain points have been no compile-time checks of translations keys actually existing 😛
I'll probably do some generator similiar to what android does in form of R.class
I just took the lazy route and return “missing translation” in that case
yeah that's how it currently works. not a good player experience 😛
If there is no matching locale you fallback to the default language
sure. but I mean accidently using mispelled translation keys or something
That’s what I do as well
But the default language may also be missing a translation :p
Default as in the default for the plugin, not the default for the user
Yeah
But the default for the plugin can be changed too
It’s probably better to have a clear error rather than it just defaulting to English
Might confuse the user if random English messages are appearing
You ever play any translated oriental games? That is exactly what happens.
Yeah really bad translations
Its the same with films
Enums have posibility to set values?
Let say i have this enum and i want to be able to change the message:
public enum Test {
Invalid_Permission("message here")
Invalid_Argument("messaage here")
private final String message;
Test(String message) {
this.message = message;
}
}
This is my config: https://paste.md-5.net/agoyiteyal.makefile
I get the location in the config by doing this which does not work properly as I only get world and not x, y, and z. I have no errors in the console:
public Location getRegion2() {
Location loc = new Location(Bukkit.getWorld(arenaConfiguration.getConfig().getConfigurationSection(getSelected()).getString("world")),
arenaConfiguration.getConfig().getDouble(getSelected()+".region.loc2.x"),
arenaConfiguration.getConfig().getDouble(getSelected()+".region.loc2.y"),
arenaConfiguration.getConfig().getDouble(getSelected()+".region.loc2.z"));
return loc;
}```
Does anyone know how I may get the location?
What does your getSelected() method do?
You know you can save and load a location directly
I have multiple arenas so getSelected just gets the section for the selected arena
I believe there is even a getLocation method
you can do directly:
Location location = new Location();
Config#set("locations.one", location);
Config#set("locations.two", location);
Location locOne = Config#get("locations.one");
Location locTwo = Config#get("locations.two");
any idea?
Already setting it like that, just tried getting it incorrectly, thank you!
Your welcome
have an answer for this
give me a few minutes
so you can't change the enum per-say but you can manipulate it when putting it into another string object. The link I gave you shows how I do this to allow custom permissions without knowing what those perms are
So its not possible to set each value?
well enums are static and final so once set they can't be changed
that is why in the link above, I use another string object to manipulate the enum
it doesn't change the enum, I just use the enum as a base and change the string for the new string object
It was possible to do what i expected
I think my explanation was really bad
what is the hierarchy and "string..." on lines 18 and 20?
String... is a varargs
You can pass any number of strings and treat them as an array in the method
oh, does it work for any type including primitives?
like int...
or just Integer...?
I believe it works with any type
that sounds very useful, thank you haha
It has to be the last parameter in a method though
that would make sense, I wouldn't even have tried to put it anywhere else lol
How hasPlayedBefore() know is a player joined before?
so how that method works is if you notice, it has the same name as the enum name
if you specify multiple enums, you can automatically have it tossed into an array
Probably checks of their player data file exists
anyone know what the type of particle that comes out of a thrown exp bottle?
once I have all the enums in an array, I can do validation check in the method below that in the second hasPerm()
i cannot figure it out for the life of me
you mean the experience orbs?
Those are potion swirls
A player file is created in the main world folder. It checks to see if it exists.
they aren't defined in the spigot docs at all
at least i think so, i haven't seen it
think those are technically areaaffectclouds
If I have a config file like this:
locations:
- loc1
- loc2
how would I iterate through each location
grab it as a list
ConfigurationSection#getKeys()
declaration: package: org.bukkit.configuration, interface: ConfigurationSection
It’s one of the SPELL ones
Probably SPELL_INSTANT
either getStringList or getList()
This was also mentioned earlier, but you can get locations directly to the config using FileConfiguration#getLocation(). If you are wanting to save locations, it's recommended to save them directly.
there isn't a getLocationList() method
you could however use getList() which grabs the list as a generic object list
and then you can cast it
There is a getList that takes a type
Yes, but you can always iterate over a list of configuration sections.
it isn't a configuration section
it is a list as they showed
yaml defines lists with the dashes
They would need to rewrite it obviously, but I don't think you can even store locations in a list format like that unless you have something custom.
Hence why I suggested using the #getKeys() method from the start.
Huh there isn’t a getList that takes a type
you can store them in a list format, you just have to do some manipulation to get it to be a location object when you retrieve it
Regardless you can just use getList and then cast it to List<Location>
server tutorial as linked above, stores locations 😛
you can always look through there for an example
that is what I suggested above lol
eventually there is going to be something I can't link to my plugin for examples XD
its does a bit of everything it seems 😛
How do I implement and advanced machine learning algorithm for catching hackers
how much should EntityShootBowEvent#getForce() be if its considered "maximum charge"?
playerdata folder?
Yes
doesn't it get a double?
let me look
float
it returns a float
but i want to check if its maximum charge
1.0 is max
ah right a float. So if I recall, 1.0 is max
The docs are your friend
theres no maximum charge in the docs ://
anytime it is a float
and what does usercache.json do? there is a expiry date. what happen after that?
well most of the time, 1.0 is usually the max
it re-fetches the user info from mojang servers
oh
that file caches user info from mojang servers since mojang rate limits its api use
most servers don't come close to the limit unless they are doing something dumb like hitting mojang server api like every second or something
Got it
Cannot resolve org.bstats:bstats-bukkit:1.8 when trying to export my project with maven. My pom - https://hastebin.de/amujuwagum.xml
only got this problem after I added essentials
updated your pom which should hopefully resolve the issue
normally you don't need to exclude transitive dependencies, but sometimes they cause issues, the modification I did should force it to not include it
essentialsx is the dependency that depends on bstats
thanks so much 🙂
How to check fox is a white fox and rabbit eye is red?
declaration: package: org.bukkit.entity, interface: Fox, enum: Type
there's probably no difference but to get a stream of an array, is it generally preferred to use Arrays.stream(arr) or Stream.of(arr)
better to use the first way
However, if you have a list, you could just do List.stream();
true, that's what I do with lists, I just wasn't sure about arrays
well either way would work for an array, the reason the first way is better is because it makes it clear that you are working with an array
where as the second way, is a generic way of just getting a stream of an object that supports streams regardless if it is an array
Entirely depends on what context
Well you can only use Arrays.stream() for primitive types and basically Stream.of() for everything else
downside of Stream.of() is that it requires flattening
also Stream.of() is a wrapper for Arrays.stream()
so if you are dealing with ints, doubles or longs, Arrays.Stream() is the way to go
I'll have to look up what flattening is, but thank you for the info
Not really
oh, that's flattening
I mean Stream::of is varargic
why do you say not really? I mean there's IntStream.of() but Arrays.stream() does that too
here is an example of flattening
// --------- Using Stream.of() ---------
// to convert int array into Stream
Stream<int[]> stream = Stream.of(arr);
// ***** Flattening of Stream<int[]> into IntStream *****
// flattenning Stream<int[]> into IntStream
// using flatMapToInt()
IntStream intStreamNew = stream.flatMapToInt(Arrays::stream);
// Displaying elements in IntStream
intStreamNew.forEach(str -> System.out.print(str + " "));
So if you just happen to not have an array to begin with, but a set of known arguments then just use Stream::of and the primitive variants
DaVinki yes but Arrays::stream is not varargic
oh alright
whenever I have a list I just do listName.stream() and so far with arrays I've only done Array.stream(arr)
anytime I've used a stream was when there's already a list or array, is it common to stream without a list or array already?
well I told you where you can use Arrays.stream() and that is with int[], long[], double[]. Stream.of() is generic and accepts any type
right, I've never used Stream.of() and only plan on it when I need it to be varargic
or if it doesn't fit the types for the Arrays.stream
if it isn't an array that contains ints, longs or doubles
I've streamed my own types before with that
yes I'm looking at my code right now
here's a stream that dealt with String objects https://github.com/Grovre/WordleCraft/blob/62a0bc7352c7e4bf5e9c5ee4e9ba0df80878e646/src/main/java/me/grovre/wordlecraft/commands/CommandUtil.java#L114
not an array of primitive types
getOnlinePlayers() is a collection that implements List or the other way around forget. So that isn't an Arrays.stream() rather List.stream()
you're right
I just streamed an array of a rectangle object
?paste
you are using ints
I am using rectangles java Rectangle[] rects = new Rectangle[1000]; for(int i = 0; i < rects.length; i++) rects[i] = new Rectangle();
which is just an array of ints
it's an array of type Rectangle
its a 2d array that takes in ints
well if it's thought of that way then isn't every array just an array of primitives at some point, no matter how dimensional they are?
No, but rectangle literally is just a type of array just like vector is
declaration: module: java.desktop, package: java.awt, class: Rectangle
so because Rectangle, like vector is an array which only takes in double or ints Arrays.stream() will work
try doing it with char[]
it should throw no suitable type at compile time if you tried with a char array
I changed up my rectangle class to just a random bunch of values and it still works, and afaik arrays can't have multiple types within
class Rectangle {
UUID uuid1;
UUID uuid2;
BigDecimal bigDec;
Long longOfRect;
Double doubleD;
double smallD;
public Rectangle() {
Random r = new Random();
uuid1 = new UUID(r.nextLong(0, Long.MAX_VALUE/2), r.nextLong(Long.MAX_VALUE/2+1, Long.MAX_VALUE));
uuid2 = new UUID(r.nextLong(0, Long.MAX_VALUE/2), r.nextLong(Long.MAX_VALUE/2+1, Long.MAX_VALUE));
bigDec = new BigDecimal(r.nextInt(Integer.MIN_VALUE, Integer.MAX_VALUE));
longOfRect = r.nextLong();
doubleD = r.nextDouble();
smallD = r.nextDouble();
}
@Override
public String toString() {
return "Rectangle{" +
"uuid1=" + uuid1 +
", uuid2=" + uuid2 +
", bigDec=" + bigDec +
", longOfRect=" + longOfRect +
", doubleD=" + doubleD +
", smallD=" + smallD +
'}';
}
}```
You can definitely stream any type of array, doesn't matter what type it is...
It's been like that since Java 8, when streams were introduced.
Well guess it don't matter anymore then
just use Arrays.stream for your arrays, since the generic way is for unknown types now it seems and not just a generic for things that didn't fit the array stream
will do
this is why it is handy to always look at documentation 😛
Even us seasoned veterans have to look at it from time to time still as its hard to keep track of everything plus a lot has changed as well XD
so about this... now it's got me thinking. if not, then what is the very bottom of everything?
depends
if it doesn't fit primitives
then it gets reduced down to object
or string which is not a primitive but treated like one
I mean technically everything eventually gets turned into bytes though since you know ram and all lmao
true
Why use integer loops?
Why not
the one I used? because you can't change the element of the array with an enhanced loop
not quite. T does not cover primitives.
But for most primitives overload methods exists.
However some are excluded like char[] or byte[] (those are covered by the traditional ByteStreams)
valhalla please 😩
Didnt really follow that. Are there plans for when this gets incubated?
That wouldnt work with primitive arrays
Not sure what the exact details are but I know that it would allow for generics to include primitives
So you could do List<int>
Which is fucking huge for performance
Primitive boxing has so much overhead
I mean... yeah. Anybody worth anything is probably going to want to get paid lol
Unless you intend on distributing free, open source plugins, or you share a mutual goal of completing some project, you're probably going to have to pay someone to devote time to working on something with you
Partner doing what?
For me it was a friend that i learned java together with and shared my passion.
Its hard to get some random person to develop without either a shared vision or compensation.
But you can always search for some motivated unexperienced devs and grow together with them.
Ive seen this countless times where newer devs just come because they want to program something
🤔
unfortunately I don't deal with LLC's in this fashion since they are not designed for private investing
you are talking about a % of the LLC which is basically an investment/investor. LLC's are not designed for this and require a lot of documents to get this right
S Corps are more better for this
I clearly have
S corps are generally private corporations that have shares already
just because it has shares does not mean those shares are public
don't ask people to effectively do free labor for you
and I have an S corp
if you're so successful then fucking pay people lol
doesn't make you special
clearly I'm dumb
"hey I had a really good idea for an app. I don't know how to code but if you code it for me we can split the profits 50/50"
🤡 🤡
You can throw around that word all you want
The bottom line is that you are effectively asking people to do free labor for you
If you decided to sell your share of the LLC there is jack the other person could do. Where as with an S corp if you wanted to sell your majority share, you actually first must offer to others that have shares first
I am not dumb
Yes, you're giving them the prospect of making money down the road
But nobody's willing to work for that
People need money
My step mom has a Doctorates in business so I am set 🙂
Potential future gains don't put food on the table, dude
Can you just shut up already
LLC's can't have stocks
Nobody wants to work with you because you're not offering to pay them, it's that simple
This isn't the place to ask for it either
Go bug people elsewhere thanks
man said thesaurus lmao
you would
you keep saying that
but also
this is a channel for DEVELOPMENT help
like
All I am saying is I don't deal with LLC's in that fashion because I rather not deal with the headache with what you are proposing or offering because I already know what it entails later down the road. Whether or not you want to get upset with that is on you, I don't care. Doesn't change the fact that what I have stated is true.
@worldly ingot please I am begging you to get this clown outta the dev help channel
because the state said so
I bet this guy does crypto
you file with the state pay your fees and voila you have an LLC. Setting up an S corp can not be done by yourself fyi where as LLC's can
LLC's can't own stocks S corps can. That means LLC's don't have stocks to give out because there is none
also it is harder to privately invest with LLC's because of this
even banks don't like LLC's very much either 😛
31
continue on in how you are the only business owner in the world though 🙂
Jesus christ dude can you just shut up
This is not the place for it
At least make a thread or something
This is the channel for asking for coding help
Please show me the stocks your LLC can give out. How much shares does your LLC own itself?
Not the place to argue about definitions over business words and request free labor
you said I didn't know anything, and I have told you what LLC's can't have
private shares don't need to be listed
one of the advantages of an S corp
@ancient plank 😭
I am not mad o.O
just telling you I don't deal with LLC's in the fashion you stated and I told you why
if you were an S corp where you can give shares, I might consider it
the reason for this is if you decide to sell you would have to offer me your shares first or to everyone who has shares as well
LLC's if you sold off your half I couldn't do anything about it even if I was half owner
they are, that is why they require a lot of documentation to just have more then one owner
where as an S corp it is all about the shares
if I own 50% of the shares there is no way you could deny that I do, because you actually have to tell the state how many shares you gave out even if private 🙂
private shares are not public information though
None of this matters lmao
No amount of throwing around business jargon is going to make people want to do free labor and this is a development channel
I am aware of this. So back to my main point I am not going to consider your offer for the reasons I stated
?services
If you wish to request or offer development/art/building/administration services, please do so at https://www.spigotmc.org/forums/services-recruitment-v2.54/
#general or #verified and don't be calling people "stupid" or such just because they say something else
Give up trying to get you to leave?
Move it or I'll just time people out. 
y'all are stupid
…
Does anyone here have intimate knowledge of the temp fly plugin, or has used its API?
Link me
We might be able to help even if we haven’t used the api
Given that the api is straightforward if that makes sense 😅
commit messages go brr
🥲
What exactly is your concern?
I’m looking to have a separate temp fly counter, for flying time from another source. When the other source of temp fly is going on, the original temp fly timer is paused while the other counts down: your source of flight changes, and the current source counts down instead of the other (has priority). It doesn’t seem like the api has a good way to do this, and so I’m trying to figure out the best way to implement it, probably a fork
I would ask the developer, but it doesn’t look like he has a publicly listed discord anywhere
setFlightTime(UUID player, double seconds) doesnt that cut it?
removeFlightTime(UUID player, double seconds) or this
When the other source starts counting down you could just add a ton of flight time.
After its ran out you simply restore the original before you added a ton.
So how the sources of the flight time count down I want to work differently. The temp flight through the plugin should only count down when you’re flying, the plugin has a setting to handle that. But the other source, I want it to count down absolute, as in hours in real life, not while flying
But your solution would work, I save the flight time before, switch it to infinite while my separate timer runs, and then once it’s over I give their original time back, and keep track of any time that was added during the other source
Ok that’d work I think, abit hacky but that’ll do! Thanks
how is it returning null?
afais getOfflinePlayer can't return null
what are you trying to do? @quaint mantle
but you do know that Bukkit#getPlayerBlaBla refers to the server?
just like we said
just that Bukkit already refers to the servers getPlayer- method
https://hub.spigotmc.org/stash/projects/SPIGOT/repos/bukkit/browse/src/main/java/org/bukkit/Bukkit.java#578
getPlayer just checks the onlineplayers
you are confusing me
you have an exception we can look at?
can you send us the exception & code context?
?paste full code context would be more useful instead of snippets.
with a CF. hopefully you wait for the result otherwise no wonder its null
refering to CompletableFuture<User> userFuture = userManager.loadUser(uniqueId);
exactly. but going async with a delayed result
the entire method
just like olivo said
and just like i did before
the entire code context
If you don't want to show your code there isn't much we can do
Good luck figuring that out
for what the hiding? you are literally asking for help but can't provide the full code context
Read the api specifications of luckperms. The user is null if there is no data associated with that UUID.
You need to properly configure LuckPerms.
UserManager userManager = luckPermsApi.getUserManager();
userManager.loadUser(uuid).thenAcceptAsync(user -> {
// Access data here
}
But before that you should always try to access online player data first.
Just looked at your code. This is exactly what you are currently doing.
me always using whencomplete and not looking into any other completablefuture methods
if i can't return anything from tasks, how would I get a player's data asynchronously and work with that?
I used to use nested runTask inside of runTaskAsynchronously, but I don't wanna bother reading that 🤡
completable future
oh
public CompletableFuture<PlayerDataOrWhateverObjectYouNeed> getData(...)
{
CompletableFuture<PlayerDataOrWhateverObjectYouNeed> future = new CompletableFuture<>();
Bukkit.getScheduler().runTaskAsynchronously(plugin, () -> {
future.complete(PlayerDataOrWhateverObjectYouNeed object);
});
}```
oo tyy
wait how do I actually return that? Missing return statement
return Bukkit.getScheduler()...?
What do you want to accomplish
I am just trying to return my player data async
You don't return it, you call whatever method needs it sync
Or Work with consumers
^
alrighty then
Because otherwise you'd need to block, which has the same effect of doing it sync
yea ;-;
One of the main reasons condem Futures
it would block the method that called it right? and not the entire program?
using consumers
Nope, consumers wouldn't Block anything If used right
then how would I get data if they wouldn't block the method that executed it-?
so something like this-? https://www.spigotmc.org/wiki/asynchronously-working-with-a-database/
@muted sand return future
I finally made my plugin
I had a doubt
This is the code of my main .java file
and i made another java file
is there any way to calculate body rotation?
hey hwo would i cancel a repeating task outside of the method
public void startRandomItems() {
Bukkit.getServer().getScheduler().scheduleSyncRepeatingTask(plugin, () -> {
}, 0, 100);
}
this is just the base for the repeating task
Look at the return from scheduleSyncRepeatingTask(
int taskID;
public void start() {
taskID = Bukkit.getServer().getScheduler().scheduleSyncRepeatingTask(..);
}
public void stop() {
Bukkit.getServer().getScheduler().cancelTask(taskID);
}```
what do i put in the brackets in scheduesync repeatng task tho
its not working for me
so not this
you could use a lambda, if you wanted
public void startRandomItems() {
new BukkitRunnable() {
@Override
public void run() {
}
}.runTaskTimer(plugin, 0L, 60L);
}```
how would i start and stop that hwen i wanted tho
store the task
using an int
i previously did that but its not working
taskID = Bukkit.getServer().getScheduler().scheduleSyncRepeatingTask(plugin, this::startRandomItems, 0L, 60L);
?
How to set keys with periods in them with FileConfigurations
Hey folks. im using LiteBans' API, in order to make my own history command with red stained glass. However, the API lists the history from oldest to most recent. Is there anyway I can make it go from most recent to oldest? I tried using a config file to save it all, then sort it inside the config, then delete it all again, but that didnt work out
while (rs.next()) {
reason = rs.getString("reason");
bannedByUuid = rs.getString("banned_by_uuid");
long time = rs.getLong("time");
long until = rs.getLong("until");
id = rs.getLong("id");
active = rs.getBoolean("active");
/*
Date date1 = new Date(time);
Date date2 = new Date(until);
SimpleDateFormat df2 = new SimpleDateFormat("dd-MM-yyyy, HH:mm:ss");
bannedAt = df2.format(date1);
bannedUntil = df2.format(date2);
ItemStack banGlass = new ItemStack(Material.STAINED_GLASS_PANE, 1, (short)14);
ItemMeta banMeta = banGlass.getItemMeta();
ArrayList<String> banLore = new ArrayList<>();
banLore.add(ChatColor.GRAY + "Reason: " + reason);
// Player moderator = Bukkit.getPlayer(bannedByUuid);
System.out.println(bannedByUuid);
banLore.add(ChatColor.GRAY + "Punished at: " + bannedAt + " GMT");
banLore.add(ChatColor.GRAY + "Expire Date: " + bannedUntil + " GMT");
banMeta.setLore(banLore);
banGlass.setItemMeta(banMeta);
inv.setItem(inv.firstEmpty(), banGlass);
*/
}```
Where is the api usage
But maybe you can collect them and then sort them
Like collect all ban info in ArrayList, sort them and then put them in the gui
CompletableFuture.runAsync(() -> {
String uuid = String.valueOf(target.getUniqueId());
String query = "SELECT * FROM {bans} WHERE uuid=?";
try (PreparedStatement st = Database.get().prepareStatement(query)) {
st.setString(1, uuid);
try (ResultSet rs = st.executeQuery()) {
while (rs.next()) {```
Ah
But try this
You can make a record class with all info
And then sort a list of them you collected
I'm using Lite LightSpigot and a CustomGapple plugin and I'm facing an issue.
So basically what the plugin does is, when you eat a Gapple, it cancels the PlayerConsume event and then takes 1 Gapple from your inventory then gives you the specific effects you intended earlier.
Now the issue is, the yellow hearts which were added to you because of Gapple's Absorption effects, don't show up in your hotbar! No matter what amplifier the effect is.
It was working fine on normal 1.8.8 Paper.
What do you guys think is causing the issue and how may I fix it?
1.8 L
golden apple
any idea why?
Store in a data structure
then reverse it
halp
or make an ArrayDeque
and loop, then add()
then you pollLast();
actually nvm dont do that
add it in an arraylist, then Collections.reverse(arrayList);
just use normal spigot and not some random fork
wtf even is lightspigot, there's nothing on google
use spigot or paper
1st and 5th bookmark go brr
yeah it's a funny song lol https://www.youtube.com/watch?v=TMOXxX5_wAA
okay it's no surprise that lightspigot breaks everything
what a scam
lol
i have dark mode spigot pog
the builtin dark mode of spigot is still pretty ugly
but that screenshot isn't from spigot anyway, if you were talking about this 😛
whats that
mcm
ic
the ugly, cursed spigotmc alternative
wdym with "initializing this"?
nah
that's not the builtin dark theme
definitely better than the builtin one
this ithe builtin version lmao
nooo
orange contrast is eh
yeah well, initialize it with some value
I don't really understand your question
?
Go anx learn java
you can "inizialize" a variable by using = lol