#help-development
1 messages Β· Page 1500 of 1
wait so this sets the field "file" to what's inside the config file?
private File customConfigFile;
no, thats just declaring the field
what does that mean
its creating a private field called customConfig of type File.
its has no assignment so it points to nothing yet. Its only declared
what is problem? Version - 1.17
teh same, its declaring a Field of type FileConfiguration and named customConfig
so one is a File and the other is a FileConfiguration
what's the difference between those two
well duh but what do they do
well, later the File will point to an actual file on your hard disc, and FileConfiguration will be used to load it into memory
confused again
To access things on your hard disc (filling cabinet) you need something to point to the correct location. That is what the File object is for.
what's the difference between object and variable
Every single thing in Java is an Object
a variable is an object
a class is an object
etc
The whole language is based around Objects
Guys, there is a way to show the Purse + bank balance in one line ? like Top1: $224,242 (count bank+purse) wiht vault economy & essentials x
when you assigned new HashMap<>() to your Map you assigned an object.
what you're saying makes no sense
um, not sure how to explain simpler
there's a difference between int test = 5; and int test = new Integer(5), right?
yes, the second one will error
ok, then no, they are the same
according to google, the second one is an object and the first one is a variable
so how come this?
Integer is an object
no integer is a type
First one is a primitive type/field
capitol I on Integer, its an Object
i'mma take a break from this, i'll ask later
ok
Ok - so my plugin for translating chat is pretty much done - anyone got any features that they think should be included?
What it does is translate the messages either to:
- One server wide language
- Per player based on the players locale
Currently the commands are just to like:
- reload
- set the mode of translation
- set the target language
wondered if anyone had anything they think should be added
So long as the players can choose their language
the players themselves? I have kinda done it so that the owner enforces a lang across the server
or - per persons locale
When I did auto translations I found I had to let players override it. Some would be using german or chinese locale but want english in game.
just set a language flag in the players PDC?
True - could do that
if no flag default to whatever
then if they don't have one then default the the server 'default'
yeah
The pain is that is prettty different to everything i have done so far 
actually, maybe not
i would probs have to work out all the languages of translations i needed, get all the translations, then map the Player -> translation. Then send the message
Its an idea tho
Im not familiar with bungee soooo, not from me 
Whats your pom?
yea give me one second
from first one
from second
Why are you shading everything?
channels = config.getIntegerList("discord.channels")
.map { it.toLong() }
When I print that (channels.toString()) it prints:
[1271005265]
eventhough in my config.yml, I have this:
discord:
channels:
- 692063419003699281
why is this?
what do I have to do now
it looks like you are shading all teh Bungee classes
Looks fine to me?
@ivory sleet but I obviously want 692063419003699281 and not 1271005265?
discord uses strings for IDs natively so might as well use that
it uses longs though
It uses strings
the library they use probably only accepts longs
As I said, replace all compile scopes to provide scopes, provided it makes sense
oh im talking about the discord api nvm ignkre me
ah just found it
Because Snowflake IDs are up to 64 bits in size (e.g. a uint64), they are always returned as strings in the HTTP API to prevent integer overflows in some languages.
yeah that's why I said natively, i know jda supports strings tho
Does anyone know a way of getting a location of a point, between 2 locations, from a set distance from one of the points? https://gyazo.com/b8893177fc25fb08be1dfb02b8cad30c Take this diagram for example, both red dots are known positions, I need to get the location 3 blocks along the line which connects the 2 (marked as a solid green line to a blue dot). I tried to do something with vectors (getting difference of x/y/z of player then dividing by their distance), but it didn't work, anyone have any idea?
guys does anyone use intelij and know how to remove the shortcut for ctrl + alt +q ?
I'm trying to add a @ but can't because it gets activated
If you have the altgr key, use that one, otherwise Β―_(γ)_/Β―
super uncomfortable to use alt gr +ctrl +q
Why do you need to use ctrl?
because ctrl + alt +q is what places @ with my keyboard
Just use AltGR+Q, why should your board not do that
alt q does not do anything with my keyboard
On most keyboards altgr + q does it
get a vector from one to the other, normalise it, then set the magnitude of that to whatever, you can get the position from the end of that vector
becuase key combinations depend on what region they keyboard is from
Alt + q does not do it, correct
Ah yeah, only AltGR+Q works
altgr + q does work but its still uncomfortable, i want to stop intelij from hijacking my usual combination for a function i won't even use
Is PacketPlayOutEntityTeleport still yaw sensitive in 1.17. It seems to no longer work for me. I am calling setLocation on the fake nms entity first with loc.getX(), loc.getY(), loc.getZ(), loc.getYaw(), 0
Vector vector = targetLoc.toVector().subtract(sourceLoc.toVector());
sourceLoc.add(vector.normalize().multiply(3));```
oh thank you
I feel like I need to look into vectors more, what does normalizing it do?
sets the x and y such that the magnitude of it is 1
ensures its a Unit vector Totals 1
basically means you can multiply it expectedly without getting funky numbers
Oh so it sorta trims big things to appear at a sensible size, so you don't get weird floating points after it?
just keep in mind, Vector#normalize uses a sqrt call internally which might not be the fastest.
well think of a triangle, if you're using the hypotenuse as a direction and you want to get an exact measurement x metres away, when you get a direction vector the length of that hypotenuse could be anything, so to work with it you 'normalise it' (i.e set that length of the hypotenuse to 1)
should not be an issue unless you spam this on a tick basis
the direction this hypotenuse faces is unchanged, only its length
Oh I see thank you
yep, whelp, either need to change how fast it occurs, or toy with not normalising it π
I mean, even per tick isn't an issue. This is more of a "store your item meta instead of calling it a bunch of times" situation
ah okay, thanks :+1:
If you don't normalise it as it is and you multiply by 3 it will print 3 times the distance to the 2nd point
Hello! I'm actually learning how to code Minecraft plugins and I want to know how to get the ID of a dropped item and put in the chat a message something like "You've dropped: (Item x64)"
Actually I have this one but it doesn't works as I want.
Hope that someone can help me ^^
?
you've got the entity id (the id representing the dropped object), not the actual material itself, you can cast the entity to Item then i believe you can access the material data there
send a message to the player from the event, u can get the item from the actual event :)
Well, I didn't explain me well. I meant if you multiply the substraction you'll get a point wich is x3 times further
oh
As I said, I'm new on this so I don't understand at all, can someone please show me a code example?
if u check the things u can get from event u should be able to find it :) I'm sure u can work it out on ur own!
Because I'm learning Events and I want to know how I can do that
Does anyone know about this? It just passed away while talking about vectors π
this is called casting
Item item = (Item) entity;
you can do this since Item is a subclass of Entity
from there you can access the material data of the item this represents
Hello, it's been several times I sent messages in this chat to solve my problem. I would like to create an event to separate chat per world but when I sent a message in the chat there is nothing. Someone can help me ?
if you send what you've tried then maybe
public void DropID(PlayerDropItemEvent event){
Player player = event.getPlayer();
Item item = (Item) entity;
if(event.getItemDrop().getItemStack().getType())```
I tried this
But need to finish it
you want it after you've checked it's an instanceof Item, since entity isn't defined yet, nor have you checked the nearby entity is actually an Item
By the way, "entity" gaves me an error
omg I'm so confused
This is so hard xd
@unreal quartz If you didn't see because of the others messages, I sent my code
there's a list in World you can access with contains all the players rather than matching the players world with the other players world
World#getPlayers()
Okay i try that
Error:
[19:35:03] [Netty Server IO #0/ERROR]: java.lang.IllegalStateException: Parameters not present, but method is0
[19:35:03] [Server thread/INFO]: An1by lost connection: Internal Exception: io.netty.handler.codec.EncoderException: java.lang.IllegalStateException: Parameters not present, but method is0
Error line:
((CraftPlayer) player).getHandle().b.a.k.pipeline().addBefore("packet_handler", "PacketInjector", h);
What I should do for to fix it?
Ok, sweet. Thanks
Hey I'm trying to make something similar to 3rd Life from Hermitcraft. I am pretty new to making plugins, and I was wondering if someone could help me. I'm thinking if I can add 1 to a deathTally, then if death tally = 0, nametag = green. if deathTally = 1 yellow, etc. I also want it to be if deathTally = 4, set gamemode to spectator. Does anyone have any ideas on how to do this?
public static ShapedRecipe createEnchantedDiamondRecipe(){
ShapedRecipe rec = new ShapedRecipe(new NamespacedKey(ma, "enchanted_diamond"), EnchantedDiamond.getEnchantedDiamond());
rec.shape(" x ", "xxx", " x ");
rec.setIngredient('x', Material.DIAMOND);
Bukkit.addRecipe(rec);
return rec;
}
@EventHandler
public void onCraft(PrepareItemCraftEvent e){
ItemStack[] m = e.getInventory().getMatrix();
int i = 0;
if (e.getRecipe() == createEnchantedDiamondRecipe()){
for (ItemStack x : m){
if (x.getAmount() >= 32){
i += 1;
}
}
if (i == 4){
e.getInventory().setResult(createEnchantedDiamond());
} else {
e.getInventory().setResult(null);
}
}
}
```this doesnt work for some reason, i am having no errors.
its supposed to create a custom recipe.
What I should change for getting the item name than the ID?
int amount = item.getAmount();```
What name are we talking about?
Localized name or display name?
Anyways both are accessible through item.getItemMeta()
I'm actually working on a Drop Item Event
anyone at my case?
And it sends a message when you dropped the Item
You only need to register the recipe once at plugin enable
Uhm my plugin isn't loading for some reason I've been stick with this for days
Without the _
Yes i know
the recipe works
Just the display name and not the ID
but the event part doesnt
I tried this but it didn't showed the name
are you there @eternal oxide
use the event.getRecipe().getResult().isSimilar to yoru item
rather than instance comparing your recipe
Can someone help me btw my plugin isn't loading
pfff, can't be asked, I'm actually learning for making something like that
Thank's for all <3
Aight
Ok, take your time, mention me please.
Who uses PacketReader / PacketHandler for events in 1.17? I have a problem adding PacketInjector after packet_handler.
((CraftPlayer) player).getHandle().b.a.k.pipeline().addBefore("packet_handler", "PacketInjector", h);
How hard is that?
packet_handler is null
using addLast/addFirst don't help
And how I can apply that to this?
public void DropID(PlayerDropItemEvent event) {
Player player = event.getPlayer();
ItemStack item = event.getItemDrop().getItemStack();
String id = item.getItemMeta().getDisplayName();
int amount = item.getAmount();
event.getPlayer().sendMessage(ChatColor.GREEN + "Has dropeado: " + ChatColor.WHITE + id + " (" + amount + "x)");```
I have this error when join to server:
An1by lost connection: Internal Exception: io.netty.handler.codec.EncoderException: java.lang.IllegalStateException: Parameters not present, but method is0
getStringList
for(String str : getConfig().getStringList("blocked-commands")) {
//
}
If youβre in main that is
i dont knwo what im listening to but its fire
Aight
OMG I think I got it. OpenJDK16 working in Ubuntu 20.04 in a docker image. That took me way longer then i wanted to lol
congrats
*clap-clap*
Not sure if you still need help, but what I do in my plugin is lowercase the Material.toString, replace _ with a space, and then StringUtils capitalize first or whatever the method is
The Material names might not perfectly reflect minecraft naming conventions but it's close for most
it still doesnt work.
?paste show code
wdym by lang names, sorry just trying to clarify
isSimilar compares meta so you don;t need the xtra check
Can you copy and paste it here where I need to put that please?
public void DropID(PlayerDropItemEvent event) {
Player player = event.getPlayer();
ItemStack item = event.getItemDrop().getItemStack();
String id = item.getItemMeta().getDisplayName();
int amount = item.getAmount();
event.getPlayer().sendMessage(ChatColor.GREEN + "Has dropeado: " + ChatColor.WHITE + id + " (" + amount + "x)");```
Because I'm looking the chat component and I'm confused asf
lastly you are checking each stack to see if its >= 32, however you have 5 stacks and only setResult if your count is 4
can someone help me with a countdown? I currently have a ticking bomb (chicken) and I added a countdown as a display name which says how many seconds is left till the chicken blows up. My code:
public void tickingExplosionRunnable(Chicken chick) {
secondsLeft = 5.0;
tickingRunnable = new BukkitRunnable() {
public void run() {
chick.setCustomName("" + ChatColor.RED + secondsLeft);
if (secondsLeft == 0) {
stop();
createExplosion(chick);
}
secondsLeft--;
}
}.runTaskTimer(BomberChickens.getInstance(), 0, 1);
}
Now Id want the cooldown to countdown by first milliseconds and then seconds like a real timer, I tried secondsLeft-=0.1 , but this added like ten 9's in my countdown and started some weird countdown.
import org.bukkit.ChatColor;
I have some code:
if (block.getState() instanceof Sign) {
Sign sign = (Sign) block.getState();
sign.getPersistentDataContainer().set(plugin.signKey, PersistentDataType.STRING, command);
Bukkit.getLogger().info(sign.getPersistentDataContainer().get(plugin.signKey, PersistentDataType.STRING));
player.sendMessage(Component.text("Set sign at " + location + " to execute command " + command + " on click.", NamedTextColor.YELLOW));
}
for some reason when its triggered, in console it prints null, while i recieve the attached image as output, any idea why its returning null instead of the command?
also, yes, i am using kyori/adventure for text handling in the spigot plugin
plugin.signKey is public NamespacedKey signKey = new NamespacedKey(this, "sign-command");
alright, i just did some checking, appears that dashes arent allowed in namespaced keys
underscores are meant to be used instead
so setResult if count is 5 and the amount == 32?
then idk why it works with _ but not -
if you want 5 stacks of 32
like you craft enchanted stuff in hypixel skyblock
do you even know java?
what do i have to do then, i am using 1.12.2 btw
tip: don't use bukkit while learning to use java, its a horrible mess
same, but i defo would have learnt faster if i wasn't doing stuff with a bukkit plugin
public void DropID(PlayerDropItemEvent event) {
Player player = event.getPlayer();
ItemStack item = event.getItemDrop().getItemStack();
String id = item.getType().toString();
int amount = item.getAmount();
if (event.getItemDrop().getItemStack().getType() == Material.CAKE) {
event.setCancelled(true);
event.getPlayer().spigot().sendMessage(new TextComponent("Has dropeado: ")).setColor(ChatColor.GREEN.asBungee()),
new TranslatableComponent((ItemStack.getType().isBlock() ? "block" : "item")+"minecraft"+item.getType().name().toLowerCase()).setColor(ChatColor.WHITE.asBungee()), new TextComponent("("+amount+"x)").setColor(ChatColor.WHITE.asBungee());```
But, I don't know why here works but in the other one don't
It' doesn't
mb mb
1 sec
It doesn't either
That's not even correct Java
Ye ye, I get it
And neither is the first screenshot
And there's the last one
Yeah you need an item stack to call getType on. You can't just magically get it
arrow.setMetadata("teleport", new FixedMetadataValue(, "true")); Having a hard time referencing the owningPlugin for FixedMetadataValue, Ik it should reference main class but about everything seems to return null
And i get this one, and putting and removing parentheses but it still like that
It's all fine, just the last one issue
xd
So bungee is still on java 8?
Think it might have switched too
hmm then its backwards then cause i am still on java 8 and it works with 1.17
Yea newest bungee with access to 1.17 still works on java 8
Good to know
Now i wait for WE and ASWE to update ....
How do I close an inventory- I feel like that's a really dumb question
It closes the inventory that's currently opened ?
Okay thanks
only for that player
if you want to do all players you will have to hook into the view of the inventory and find the users to close
Yeah that's what I want
omg I'm so lost actually
π₯²
I thought that can be more easier than this but omg
Now comes the best part of a new update. After the plugin updates and server working.
SPIGOT PATCHING!!! YAY!!! NOT!!!!
public void DropID(PlayerDropItemEvent event) {
Player player = event.getPlayer();
ItemStack item = event.getItemDrop().getItemStack();
String id = item.getType().toString();
int amount = item.getAmount();
TranslatableComponent component = new TranslatableComponent("test");
component.setColor(ChatColor.WHITE.asBungee());
event.getPlayer().spigot().sendMessage(new TextComponent((ChatColor.GREEN + "Has dropeado: ")));
new TranslatableComponent((item.getType().isBlock() ? "block" : "item")+"minecraft"+item.getType().name().toLowerCase()).setColor(ChatColor.WHITE.asBungee()), new TextComponent("("+amount+"x)").setColor(ChatColor.WHITE.asBungee());```
Thats all the code without fixing it
just cause I'm so lost atm
Indeed xdd
?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.
Can anybody help? I'm looking for the event for when a player destroys (mines) a block.
BlockBreakEvent
thx
Hello there is any method in spigot 1.17 to create a huge world ? With the height more than 256
according to the API diff, no
We doing some programming homework or smth π
the values you gave a far from linear
let me open up desmos and plot a few graphs
\frac{x}{\log\left(x+10\right)}-x+20 would do something like that
it's not linear
Sure, but is is pretty linear
of course one needs to play further with the values, but something like that could be a good initial suggestion
true linear would be something like x = y - z
Hello, I have a question is it possible to cancel a sendMessage ?
You'd have to cancel the packet @unreal sandal
mmm
depends on context
i think there might be an event too
How can I do that @quiet ice ?
If you mean recieve then it is possible via AsyncPlayerChatEvent or something like that, sending requires packet forgery afaik
Yeah I doubt sendMessage executes an event
does anyone know how to make a very simple variable file so the variables don't get erased on restart?
https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/event/player/PlayerChatEvent.html
https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/event/player/AsyncPlayerChatEvent.html
declaration: package: org.bukkit.event.player, class: PlayerChatEvent
declaration: package: org.bukkit.event.player, class: AsyncPlayerChatEvent
i think one of those would probably execute on sendMessage, add a listener and try
@lean gull Simplest way? Just use the YAML stuff
You can even serialize a class with it
yeah i have no clue what that means
Write stuff to a file and read it
Not recommended at all
It'll save all your object fields, and such into a binary file
@quiet ice Yes, but when a player send a message, I cancel already the packet and after i send a message to player, because I want to separate chat per world
@quiet ice Why not?
It's incredibly efficient compared to YAML
And only a couple of lines of code
Did you ever actually try it?
Yes
i mean there's this but i can't even understand it
https://www.spigotmc.org/wiki/config-files/#wikiPage
I've been programming for 10 years lol. Works great
It is really dumb if you ever want to change the class
True
json is a decent middle ground
Could just use the YAML stuff from Spigot then. Super simple
Works really good if the class never changes, otherwise really dangerous stuff
And then you need to understand the meaning of transistive and co
funny name though π externalizable
Not with the other 1
You need to read that page over and over until you do understand it. Try out the code it shows you and google what you can;t follow.
But obviously refactoring will fuck it
I just encode everything via ByteBuffers heh
ok
you can create a class that can write read things
Or json-simple, which has also done a good job in the past while not being too complicated for me
and if something is missing it simply leaves the defaults
how to use PacketPlayOutScoreboardTeam in 1.17?
supposed that the bytecode contains a header and the payload format
That Spigot wiki is so lacking lol
How do I do a config option with subconfig options? also smth like this https://imgur.com/Jkg3unZ
wut
you press keys on your keyboard
to write text
or are you asking how to deal with nested configuration keys with the bukkit config api
"do" is quite vague
yes that I mean
sry
key.subkey
hey?
Is spigot for 1.17 yet released?
i tried but it's wayy too advanced for me, is there another option?
apparently not basic enough for me :/
you should try doing something else first
right now you don't know anything about anything
do some stuff that you vaguely know how to do, and get more experience
this is the second time you said i know nothing, i'mma just block you
you literally don't
you are trying to write a computer program, but you don't know what a hard drive is
you are trying to use an object oriented language, but you don't know what an object is
does anyone else know how to help?
do something simple; approach these concepts at your own pace by doing simple things
right now your foundation is next to nonexistent
The tutorial I linked you IS the help. You need to understand it as it is how to save and load configs
i can't
There is fully working code there, you just need to practice with it.
Then you can;t write your plugin if you can;t learn
yeah i'm blocking you too
lmao
lol, I spent hours tutoring you. ungrateful noob
is anyone here not mean, not telling me what i can or can't do, not saying i'm somewhat incompetent that can help?
do you really want me to block you too? dw, i will now
Elgar and NNY are both right
He's going to get very lonely in here.
lol
if im using lucky permissions can I give temporary permission to player via spigot API or do I have to use luckyperm API?
you mean luckperms?
bukkit does not have a concept of temporary permissions
i would use vault's permission module
No idea if LP supports temporary, Other plugins like GroupManager do π
as otherwise your setup won't work with any other permission plugins
like pex, which is better than groupmanager
King of the gutter
real men store their permission data all in one permissions.yml
Real men don;t need no permissions
op everyone
real men aren't permissible
so I should switch to PermissionsEx?
haha no π
LP is the standard
but you should program against vault's permission module rather than a specific permissions plugin
Well, v2 (I think that was the right one) would work, but it isn't the one you can obtain easily
Is there any guide for that?
But honestly, GM supports timed perms. Pretty sure LP doesn't you'd have to code them yourself.
then append "spigot" after the search
or "bukkit"
and that will show me how to install it
The latest releases of PEX (which are a few years old) have not been supported for some time, however if you build the latest commit yourself I think it is somewhat supported iirc
Vault is a plugin you will have either way
brought to you by the power of google
thanks google
It is probably the most used library plugin, though it is heavily outdated in design
honestly I searched alot about vault and its the first time I encounter this page
"feature complete"
can someone explain to me this part of this article?
part: https://i.imgur.com/CmWKFV6.png
article: https://www.spigotmc.org/wiki/config-files/#wikiPage
(it's at the bottom of the page)
there is little to explain
getCustomConfig is a method that returns a Configuration
you then call getString on that returned Configuration
to get the value of some specific config key
getCustomConfig is something that you'll have to write yourself in your main class
so lucky perms uses vault?
no
vault uses lucky perms
and/or any other permission plugin
vault's job is to find and provide access to whatever economy and permissions plugin might be installed on the server
so instead of you having to write your plugin against a specific economy and permissions plugin, you can write it against vault
so this is outdated? ```Vault currently Supports:
Perms: Permissions 3, bPermissions, PEX, GroupManager, PermissionsBukkit, zPermission, SimplyPerms, Privileges, DroxPerms, xPerms```
probably yes
try it and see; i'd expect it to work seeing as LP is the industry standard
but i suppose I've seen weirder things
Hello, I need help on preventing player from placing /throwing custom items. For example, I have an enderpearl called the transmission conduit, and I want to setCancelled the event when a player throws that pearl, but not if it's a vanilla one.
add a tag in the pdc of your custom items
and check whether that tag is present when throwing/placing/using, if so, cancel
PDC? Sorry, im kinda new to this Spigot plugin thing ^^'
so uh
persistent data container
cant he just compare to vanilla Materials?
basically a Map that stays on the item forever
Okay, thanks!
what the hell does this mean? am using gradle with a final class, doing the auto fix thing does nothing
or simply the custom name ?
no, custom items have the same material as their vanilla counterparts
you cannot add new materials
comparing the name is gay as well, as the name could be changed by a player
I meant comparing Tags
When throwing an item, meta gets deleted
I had that same issue today actually but nothing happend when I clicked it
isSimilar()
anyone?
You haven't declared the dependency correctly or Eclipse/IDEA have not yet been reloaded properly to reflect the changes in Gradle, probably
isSimilar is too specific
before throwing
Is there an event for that?
if the item changes durability or is renamed or anything about is changed, it will return false
restarting intellij
You just have to reload in the sidebar
does if (!sender instanceof Player) would work for cmds?
no
i tried doing it on my own and uhhh
if (!(this.getCustomConfig().getString("chat-color"))) {
this.getConfig().set("chat-color", true);
}```
https://i.imgur.com/NE5FQt7.png
it'd have to be if(!(sender instanceof Player))
since ! is evaluated before instanceof
and you can't do !sender
because sender isn't boolean
It has built in support for most of those still. Other perms and eco plugins detect vault and hook into it
i have no clue what i'm doin lol
yes, we can see that
getString returns a String
you cannot use a String in an if directly
you need a boolean
you can either compare this string to something, or getBoolean
basically, learn java
i have done this, restarting doesn't solve the issue π
ye seen it by IDE, would that work actually with non-boolean things like this? also if non player throwing an error or do I need an else statement?
k thx
what do u actually try to do?
get a player import
shit
can someone please help with what i sent?
invalidating
no, but if you want to support vault, which you should, you should register your plugin as an economy provider
I meant this private boolean setupPermissions() { RegisteredServiceProvider<Permission> rsp = getServer().getServicesManager().getRegistration(Permission.class); perms = rsp.getProvider(); return perms != null; }
to access the perms
seems about right
hmm, why a new economy plugin? we already have so many
I want a minimal one
I don't know if I did something wrong, I don't really understand PDC syntax
an EntityType will never be equal to a Material
iCo5 is minimal
what the fuck
I know a few more minimal ones too
it's still happening
this is an very minimal one https://www.spigotmc.org/resources/xconomy.75669/
could it be that this java file is in the test folder aux?
things in the main folder are just fine
just adding money, nothing more
use whatever but stay away from theneweconomy
renaming commands etc
I don't know if this is I'm supposed to check if something has a specific pdc?
bukkit has a feature for renaming commands since like.... idk?
number one
an EntityType will never be equal to a Material
so this will never run
number two
Well where else should I do it, since I need to put a setCancelled(true)
you are checking the pdc of the entity, not the item
Yeah, its e.getEntity
listen to either the interact event or the specific throwing event
and check the item
the tag will be on the item; not on the entity
I wanted just YAML database and a instead of /eco it will be /bits
also helped me learn the API a bit better
use commands.yml to create a /bits -> /eco alias
look in the commands.yml
there u can define aliases for cmds
have you written the eco side of the plugin yet?
https://github.com/WeiiswurstDev/EasyConomy uses a YAML database (note: I had involvement in the development of that plugin)
seems you've created a variable called 'jsonlistentry' which is null and has no value
that's NMS
I'm doing a Node that can create a server instance on DEMAND...
it copies everything and edits server.properties to feature the correct port, and it gives that
yea its working fine
does anyone have any ideas?
can give code if needed.
and I also get spammed with this error every 1 nano second at join on the server.
Technically, I could do something like this and I won't need to do the PCD thing
then implementing vault is fairly easy https://github.com/iconomy5legacy/iConomy/blob/b90b24fadda6877ccc004a912fba2c05330f113b/src/main/java/com/iConomy/iConomy.java#L190
anyone has ideas...
Hello, I'm looking for a Join Title code but I don't found nothing, someone can help me please?
@last sleet yes, but that's gay and imperformant
just tested it and i didnt work ;w;
and not applicable to everything
yeah im gonna use pd
you should learn to do it right the first time around
c
that way you'll have an easier time in the future
I never wrote the implementation. Just linking him an example π
i still need help ._.
maybe you shouldn't have fucking blocked everyone who was helping you
maybe write what ur actual issue is?
i did
^^^
With what
and like I said, you can't throw a random string in an if condition
you need a boolean
^^^
You have a very low knowledge of java lingo, which makes it a bit hard for us to explain anything as we automatically use that lingo.
His issue is he knows almost nothing about java,plugins or computers and is unable to understand the basics.
That directs you to the string associated with the path of where it is in your config
i don't understand that
/\ ideas?
He won;t understand path, label or anything you say. I already spent hours explaining it very carefully.
before getting blocked for refusing to spell it out step by step again
String notSet = this.getCustomConfig().getString("chat-color");
if (notSet) {
this.getCustomConfig().set("chat-color", true);
}```https://i.imgur.com/DJJtc75.png
yeah, that's not how java works
ignore that it will be the oppisite
Isn't there a #hasString()?
yeah, and an isSet
He's gone off the tutorial and is already attempting to implement in his plugin not knowing any of it. Its all wrong. He has a Map<String, String> he needs to save to a config. As its a Map all he has to do is use put
or set
Why cant I use CraftPlayer in 1.17 Spigot
so wait, I have this in my eco plugin getServer().getServicesManager().register(Economy.class, this, vault, ServicePriority.Highest); do I need to do the same for perms as well?
put is for maps
elgar is a noob
Well @lean gull donβt use a config
doesn't even know how to use maps
haha
that's not helpful
his choice was a database or file. We went with the simplest
how else do you want to store stuff persistently?
Donβt use either yet you need to stick to storing stuff in memory
Heβs not ready for either of those obviously.
So he just shouldnβt do it yetβ¦.
how the hell am i gonna save on restart if i save on memory
Meh, BufferedReaders/BufferedWriters are pretty easy
he's not ready for plugins, but I was willing to teach.
lmao
Elgar π₯²
You need to take some steps back before doing this
bomp just stop helping please, alright?
Lol thereβs no way to help you
lol, you'll be blocked too π
But I encourage to use configs since BR/BW are non-conventional
then you shall be the 4th person i've blocked in the last hour
I encourage you to go sit in a main method in a new project
he's going to have the whole guild blocked before long
i have no clue what br/bw is Β―_(γ)_/Β―
I assume buffered writer and reader
just in case this got missed
Whatever clsss you want to pass
if you are writing a permissions plugin, yes
Into another plugin
that is, a replacement for luckperms
Talking about that, is there a better way to test is an item is a custom item? I'm doing it like this right now, and i doubt its very efficient.
so I get an error
hey laurent, want to do me a favor
Yes?
tell @lean gull that he smells bad
'register(java.lang.Class<T>, T, org.bukkit.plugin.Plugin, org.bukkit.plugin.ServicePriority)' in 'org.bukkit.plugin.ServicesManager' cannot be applied to '(java.lang.Class<net.milkbowl.vault.permission.Permission>, com.elunar.plugin.BitEconomy, org.bukkit.plugin.Plugin, org.bukkit.plugin.ServicePriority)'```
good job
):
Axilirate your class needs to implement the Permission interface iirc
Economy
anyway, the better way to test for a custom item is through the PDC
Assuming you wanna provide an implementation for that also
why is 90% of every server are mean
instead of reading and comparing the lore, read and compare the PDC
Anyone know the permission to bypass checks for a player so they don't get banned? Tried nocheatplus.checks.* and everything but nothing works. I am using PermissionsEx for permissions.
oh my bad
ty
missed that'
Depends what makes the item custom lol
what does that mean? Class 'BitEconomy' must either be declared abstract or implement abstract method 'hasSuperPermsCompat()' in 'Permission'
this means that your class is implementing Permission
which declares a method named hasSuperPermsCompat
but your class does not implement that method
@lean gull but letβs be real here, people are here to help others who already know code. By the looks from it, you seem to lack the very fundamentals of java and object oriented programming. I would humbly recommend you to start with learning Java solely then try to tackle the Spigot API. You kinda need to be able to walk before being able to run.
?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.
I thought you were doing Eco not perms
you must either implement that functionality, or make the class abstract (and implement it in an extending class)
i have no clue what he's doing by this point
just dumping everything in one class in my econ plugin so I can use vaults permmisions
um, eco/permissions
unless you are writing a replacement for luckperms, you don't implement Permission
If you do then you have to accept the fact people wonβt help you here. Weβre not Java teachers.
what are you trying to do? register yoru eco with vault, or access vault for permissions?
I mean i learned java in minecraft pretty much
what you are doing right now is writing a new permissions plugin, to replace PEX or groupmanager or luckperms
He can do it, he obviously isnβt trying very hard tho
Sure we are
we can be java teachers
(in a way)
ok now it clicked
this article is in the spigotmc website...
anyone can do anything if they're willing to go far enough
unfortunately this guy isn't willing to get off his ass and open up google
can I ask you a question NNYaKNpGms0eUVpiSdHx
where did you get your name from?
how old are you btw?
from a random string generator
If you want to read permisions, just read them off the Player. If you want other plugins to access your eco you register with vault
I'm making it my spigot account password
in 2 months i'll be none of your business years old!
it'll be very secure
no one will know
Happy Early NoneOfYourBusiness Birthday!
thank you!
Yes and it applies here nevertheless. If youβre lucky enough you might find someone which will help you a bit but youβll still have to accept the fact not everyone is willing to help you. As Bomp said doing this in parallel is possible but I donβt know if itβs the smartest thing.
I wanted to give player a prem, NNYaKNpGms0eUVpiSdHx suggested doing it via vault.
yes
you want to get the permission provider, through vault
what you are doing now is registering a new permission provider
Id make your own system @iron condor itβs a good learning experience π
ok, giving a perm you can do, however, you wanted it timed? which means no point in using vault
I'm trying to make a Login playsound but it doesn't works, maybe I need to add/fix smth? Please help (I'm new coding)
would not recommend
he wants to do the timed part himself
as in adding it, and then removing it after a delay
as he is tracking it for timed theres no point in pushing it to vault
Actually doing meaningful stuff instead of fucking around is better at some point
Making a permissions plugin is prolly the most beginner project imo lol.(well medium idk)
some people said to not set stuff on the config from other classes than main, is that true?
Just add it on Player join and remove when expires
I do not see an issue with it myself
alright, thank you
Try using playerjoinevent instead?
However it always depends on how exactly it is done
Could it be your pitch and volume
i'm doing it like in the article,
// Reading from the config
String name = plugin.getConfig().getString("player-name");
// Writing to the config
plugin.getConfig().set("player-name", name);```
I assume 0 cancels it out
so I just use the Permission.class provider?
It doesn't works either
I tried both
@mystic terrace
Is your sound even on
ye lol
I should try to put it in 1?
Make sure you ctrl left click on the methods and see what there doing when itβs not working. Lmk yw
if you want to add perms then you get the rsp for Permission.class
alright, shouldn't be that hard
Doesn't works
public void onLogin(PlayerLoginEvent event) {
Player player = event.getPlayer();
player.playSound(player.getLocation(), Sound.BLOCK_BEACON_POWER_SELECT, 50, 1);
}```
consider delaying the sound a few ticks after the join event
how?
the bukkit scheduler
how? (I'm a noobie)
google "bukkit scheduler programming"
I have that xd
Use playerJoin event not player login. During the login event teh player has no world set yet and will always report the servers main world
Bukkit.getScheduler().runTaskLater(plugin, () -> { delayed code here }, delay);
You will also need to delay it till after the Join event has finished ^
I'm lost
Done
see what happens if you havenβt already tried it
I mean you can try player.world.playSound see what happens too
you need to delay it
But yea try a delay or try a different sound
can someone please explain to me how to use this? i'm trying but it turns red ):
https://www.spigotmc.org/wiki/config-files/#wikiPage
Omg bro lol
Whatβs the error
This guys the ultimate memes
and here we go again
Good luck
As I said, I'm new on this so I don't understand at all, can you make me an example with the code of here please?
@EventHandler
public void onLogin(PlayerJoinEvent event) {
Player player = event.getPlayer();
player.playSound(player.getLocation(), Sound.BLOCK_BEACON_POWER_SELECT, 1, 1);
}
Bukkit.getScheduler().runTaskLater(plugin, () -> { delayed code here }, delay);
non-static method cannot be referenced from static context
Ok, but, where I need to put it exactly?
Yes
That line wraps around the code you want to run
look at what I sent
it has a "delayed code here"
what might you want to put there
Like this?
Bukkit.getScheduler().runTaskLater(plugin, () -> { player.playSound(player.getLocation(), Sound.BLOCK_BEACON_POWER_SELECT, 1, 1); }, delay);
Yeah youβre calling a non static method in a static method
Yes
then set teh delay to something like 5L
and get a plugin
this is probably the biggest challenge for you if you're an oop or java noob
how
how
Indeed xd
replace delay with 5L
i removed static and it still not working
done
now, you need an instance of your main class
Now i have those
import Bukkit
Pass your main class into that classes constructor
whot
MainClass.getMyInstance()
Is this code in a class thats not your main?
the other is to pass the instance to the other class via constructor
Is the method supposed to be static?
idk Β―_(γ)_/Β―
somebody seriously needs to write a "how to dependency injection" tutorial
just change plugin to this
I mean your main should never be passed to a lower level class in true injection zzz
Bruh what
i'm very new to java and spigot
If you donβt know what youβre doing how can I help
true injection is gay
?
only junkies inject shit
blocked number 5?
done
any more warnings?
Only noobs pass there main class into every class possible
now it's completed or I need to do something more?
see: drug-related epidemics
Noup
i replaced WooToo with plugin like the article said, now plugin is red
What?
you don't pass the class; you pass the instance
Youβre allowed to I guess
@wraith rapids donβt be annoying you know my point
i'm a pretty annoying guy
Thats like telling water to not be wet
You canβt write a tutorial on how to do something wrong
Doesn't works XD
Thatβs just stupid
passing the main class instance is fine
if you actually want to go DI purism, use a framework
I don't know why but it still without working
but as said that's gay
What lol, itβs fine but itβs still bad practice
have you built the plugin?
Use a framework?
Hey, I'm trying to importing new NMS classes to craftbukkit. i paste all of NMS Classes (in work/decompile-xxx) to Spigot/Craftbukkit/src/main/net/minecraft/server folder then i opening project in IDE but I'm getting lots of error in classes, plz help
wront quote
Learn Java first
Ye, i did
here it comes
???
then set the delay a little longer. You need enough time to finish the login
Hey, I canβt find an event for when a mooshroom changes variant due to a lightning strike. I know itβs very niche, would just using the normal lightning strike event work for preventing the change to a brown mooshroom?
20L
like guice
Whot the L means?
long
Long
f would be float, d would be double
That stuffs stupid imo, Just pass it through lol. Itβs so easy
uhm
if you want to be a DI purist, you most of the time need a DI framework for it
No you donβt
or, basically write what is a DI framework into your plugin
but that hardly counts
Do you know what youβre speaking about with all honesty?
Lmao, I don't know, it still without working
yes
Disregard, found the entitytransform event, I think that might work?
Guice got me dead
A di framework
perhaps what we are disagreeing on is the definition of purism
Have you tried dagger Bomp?
then try a different sound. 20L = 1 second delay, should be plenty
Itβs a simple concept of just having ordered level classes
Uhhhh
that is one component of it, but not its full extent
Access your main instance is the single most controversial topic here
If youβre talking about dependency inversion principle inheritance and abstraction plays part
For simple dependency injection yes thatβs pretty much it
I have an error, I'm doing a jar program which can create a server using a template, but every time that server starts up it starts with this error, any ideas guys?
-> https://paste.helpch.at/oputajinot.apache
the jar also changes the port of the server, but it doesn't matter...
I have not is it for injection?
let us agree to disagree then
Don;t look NNYa
Which slot number is the result slot?
Ok
Itβs compile time injection as opposed to guice which uses reflection
And unsafe iirc
I don't know whot I need to do for real xD
Ah yea thatβs why I donβt use any injection helpers lol
you probably don't use the bukkit event bus either, then
I made my own wrapper for it yes
Well, you can try one last change it to 100L (5 seconds) If it still plays no sound your ears are broken
but you are still using it
I mean you can simply make a fresh class that implements plugin. Fill out the methods
No I donβt use handler list
Lemme try xD
literally what are you doing then
Perhaps there is no sheep!!!
the sound of sheep is just the cogs of capitalism turning
there is no need to be concerned by it
Send me your dealer
perhaps that is because of rising unemployment
lol, back in 10 mins
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
Try it on your's
I tried all
50L
100L
I changed the sound
Is the plugin loading haha
O_O
why the hell don't I have an answer....
oh yeah by the way
help me
your class needs to implement listener
pls
the method has to be annotated with @EventHandler
How
Yea I was about to say
and it needs to be registered with the event bus
cand you show me how?
Java ?
i saw it in your class and was going to mention it but was distracted by the DI purism debate
me too
ok we didn't asked
well at least I would never waste your time neither give you up
ok maybe waste a lil bit
So, you can help me?
google "how to implement an interface java"
and then "how to register an event listener spigot"
OK what about me π’
your project kind of goes beyond the scope of things I can effectively help with
what is the exact issue
i also can't see replies
implement Listener
class Main implements Listener { is how you implement an interface
I have an error, I'm doing a jar program which can create a server using a template, but every time that server starts up it starts with this error, any ideas guys?
-> https://paste.helpch.at/oputajinot.apache
that's it
ugh
open up the server source and figure out why that is null