#help-development
1 messages · Page 2121 of 1
no
how would you interact with it
read this
if it doesnt even exist
via any method in the resource
the resource wont work if its not running
True true that a big point
ok so tell me
you seem to be confusing a resource with a running application
if i directly connected to a database
define resource then
a resource/library could be somethign as simple as a collection of images or compiled functions to perform some task.
How you interact with that resource is its API
so interacting with an image is an api
do you mean the thing that lets you interact with it, or the former?
an api for a database would be the middleman inbetween you and the database that provides you with information in a predefined way
you access an API to use the resource
the same thing applies for programming
It may be Javas Image methods or some custom methods in a library
when you connect to say the youtube api
Makes sense
you are connecting to a service that connects to their database
you aren’t directly connecting to their database
it acts as the middleman
However the API itself, it does have to be running doesn't it?
no
an api is simply an interface that either exposes information or takes instructions to manipulate data
just accessible
you could technically say anything is an api
How would you use any of its methods if its not running
none of the code in an API executes until you call it
but for example
if a plugin is shut down for some reason
and it has an api
im using its api, it wont work since the plugin is shut down
it has to be running for me to use it
Yes, but they are two different things
teh API you use to access it is not the plugin.
if the api just accesses a Map with data, that will still work
which circles back to why we would use dependency injection 🙃
What?
what does it have to do with what we're saying
that’s what this originally started from
Nono
the message you replied to
that doesnt circle back
What elgar said makes sense though
But I believe we both are wrong lol
in a way or another
because we don’t want that to use it’s own plugin
anyways back to the current thing
Do Spaces On Codes Used Affect Optimization?
define that and it
An application programming interface (API) is a connection between computers or between computer programs. It is a type of software interface, offering a service to other pieces of software. A document or standard that describes how to build or use such a connection or interface is called an API specification. A computer system that meets this s...
keyword: between
dont send me wikipedia pages
conversate if youre willing to
anyways
definite
"That"
and "it"
i am giving you a source for my argument
Sure, now definite that and it
uwu
ie Player is a Bukkit Interface which describes how to access its members
hi elgarr <3
what does that even mean
"because we don’t want that to use it’s own plugin"
Define "it" and "that"
Hi Purple
i wasn’t even making an argument
why are you not defining it though
just pointing out a smaller thing i noticed
do you not understand what you said?
whatever connects to the plugin
the second being?
inference of english would give you that i was referring to the same thing
"because we don’t want whatever connects to the plugin
to use whatever connects to the plugin
own plugin"
Elaborate
ok i’ve had enough of this
read the full sentence
Sure I did that
Yeah I was gonna say how long is this gonna take
now elaborate
i have elaborated more times than i can count at this point
It’s been fun reading about ya two arguing over smaller concepts to clarify the starting thing but now at this point it’s Annoying
yeah lmao
If you cant elaborate i will assume you dont understand what you said
people are trying to find development help here
not to see 2 people arguing over what an api is
I’m just in it for the drama rn at this point
it aint drama tho
Oh I did ask for help but the saw u guys arguing and found it funny
Na forget it that can wait I want to see where this goes
He doesnt seem to understand what he says
i am out of energy
Sure
i understand what i said just fine
Lol
explain it again then
nearly half an hour
if you dont answer a question in an argument that means you have no answer
or maybe it means i’m tired of arguing for half an hour
If you were, you would've leaved
I don't see how moving your fingers on a keyboard tiring
and then it repeats
lmfao
ok i’ll just leave this be
Sure
thank you and have a good day
you too
Lmfaoooo the conclusion just ends with both sides being fed up oh man this was greate 😂😂😂 anyways This is what I needed help with btw
you would use the get and set methods in file configuration to create and obtain data
Yeah tried this multiple times never worked
Yea
did you use #save() afterwards?
It’s all in the code that I linked
plugin.getConfig().getInt("lol.test.something", 0)
Oh ok I see
the 0 is the default value
and you would do
plugin.getConfig().set("lol.test.something", 10);
to set it
and
plugin.saveConfig()
after u made all the changes
ig thats fine for now
but later on when u advance u wanna cache ur values and only perform IO operations on program exit
Hello, i cant figure out how to fix this error. Can someone help me? https://pastebin.com/mXZfhZwh
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.
can i fix so that doesnt send out an error?
ill send you the code, one sec
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.
if (Objects.requireNonNull(e.getItem()).getType() == type) {
so um
check
if e.getItem is null
before doing ur check in line 57
since if the item is null, it wont have a type right
an empty inventory slot is empty, it has no minecraft item in it
got it?
so u gotta check if u clicked an empty slot before trying to know the type of item in there
yea, i think i get it. Thanks
if(e.getItem() != null)
that should be enough right?
adding that before
Can u give me a small demonstration cause I’m not so sure how I would set it up, I’m just starting to learn how to use config files and all that
ah okay, thanks
it stops ur code from running if the item is null
well
heres an example
plugin.getConfig().set("players.bladestorme.coins", 10);
plugin.getConfig().set("players.hex.coins", 15);
plugin.saveConfig();
plugin is ur java plugin btw
(ur main class)
so basically
players:
bladestorme:
coins: 10
hex:
coins: 15
this will be the result
the . means to go down a section
saveConfig() saves the interaction youve done to the config
the actual file
this isnt really good to do but its the easiest way to explain it now
btw
try watching this https://www.youtube.com/watch?v=dzTIR6_AZ6w
Sorry for the length of this video, I wanted to be as detailed as possible. This episode I show you guys how to create a config.yml for your plugin and add functionality in your code to be able to access the data in the config file and also to be able to set the data. Stay Updated!! 👁
⭐ Kite is a free AI-powered coding assistant that will help ...
this guy is awesome
in spigot tutorials
Ok I see and I would set up plug-in.getConfig().set(“player.bladestorme.coins”,10) would be set up in main class and from there I can also just implement that into the current config that I have it set up in and use it, and yeah Ik Cody I’ve watch his videos and all but the way he set up custom configs is not really what I was looking for, this method that Y2K_ showed me makes it so I can create configs like how u can with the default config by creating the file and giving u access to adding comments and all that but I wasn’t sure how I would implement what Cody shows in the video using this method
Tru dat
oh well
do u have a fileconfiguration
object
is there a way to place blocks without massive fps drops due to lighting calculations
ok so
replace plugin.getConfig() with
the object from utils_config
.getConfigFile();
So I’m at work right and I’m not home most times during the days so I have MicroSD card that holds all my projects, and a RaspberryPi 4 8gb modle, I found out a way to get data off the type c port that usually only transmit power and local host it to my iPad Pro 12inch so I can just do sudo local.host.o in a terminal or some like teamviewer and connect to my pi locally by tricking my pi that my iPad is a router, so this way I have a portable workstation anywhere I go regardless of having internet or not I can connect to my pi and work on my projects
U fricking genuis
It’s the perfect workstation plus once I’m home I just connect my micro sdcard to my main system then just work of that
And when I’m done I can put it back to my pi and boom 💥
how can i check if an integer value is odd?
Man u r so smort
wait but u can code in an ipad?
Use the % operator
Yes but the programs aren’t as advanced
So might as well just get all my tools and everything in on the go
Rpi my friend
On the pi
how can i check if a number has decimal values?
Hold up let me record and show u guys
Yes iys just linux
Check what it returns, give a bit of context pls
How r u getting the number
of course u can install intellij on a raspberry pi
tho who would want to, damn thing is way overpriced atm
i have a number, i divide it by 2 and i get another value. i want to check if this number has decimal values so that i can determine if the number is odd
I have 8
lmao
how much is a rpi 4
I have 12 set up in a super cluster
So when u divide, it returns a float or a double?
super deathstar
how do i know?
Division can also return ints
Rn because of 3rd party sellers and also not being able to find them anywhere it’s around 150+
As well as longs, beware of that
I tried setting one, failed, got a huge xeon servet later
unless it changed since I checked a month ago, you can't even get one for sale
Here is the video
No no no
int div int = int
if you are able to though, it'll cost you a pretty penny or 10,000
int div float = float
int div double = double
3 / 2 isn't an integer i guess
if ( num % 2 == 0 )
System.out.println("Entered number is even");
else
System.out.println("Entered number is odd");
3 / 2 = 2 iirc
where is the NumberUtils.isEven?
No, 3 / 2 is 1
That ip that u see is a local static ip that I set up so only when connected via type c u can connect directly to the pi with all perms
return num % 2 == 0;
It rounds down
Yeah u need to make sure that they have all the settings sync up besides name and password for user pi, and also beta way is to use eithernet to sync em up u have no problems that way
or !=
true
real ones use iseven api https://isevenapi.xyz
No dont thats a joke
Welcome to the hell that is JS
100$ per monthh
Bruhh
Wha
i will absolutely pay 99 dollars for a isEven API
So cheap
For some reason ```java
this.saveDefaultConfig();
Gives me an error
java.lang.IllegalArgumentException: The embedded resource 'config.yml' cannot be found in plugins\Main-1.0-SNAPSHOT.jar
at org.bukkit.plugin.java.JavaPlugin.saveResource(JavaPlugin.java:193) ~[spigot-api-1.18.1-R0.1-SNAPSHOT.jar:?]
at org.bukkit.plugin.java.JavaPlugin.saveDefaultConfig(JavaPlugin.java:180) ~[spigot-api-1.18.1-R0.1-SNAPSHOT.jar:?]
at de.firecreeper82.main.Main.createConfig(Main.java:23) ~[?:?]
at de.firecreeper82.main.Main.onEnable(Main.java:19) ~[?:?]
I was gonna buy the rapid api is odd
best investment i ever made
Do u have a config.yml on ur project folder?
You know that I always point at the Java virtual machine specification or java bytecode if someone asks me somethign like this.
But about design? You are asking the wrong person, I like backends and developing APIs but frontend design is hell
doesn't
this.saveDefaultConfig
Create one for you
no
man not front end
project design
design patterns and such
Do I have to create it manually
U need to have one in ur project's resources folder as well
BRO I JUST TESTED ISEVEN API
{
"error": "Number out of range. Upgrade to isEven API Premium or Enterprise."
}
IT ACTUALLY WANTS I
It will create one when u run the server, just make one in ur prj's resources folder
Xd
Lol
ok
A joke
bruh
Bruh imagine having to pay for it, that’s why u either make it or find an open source one
You can make one easily
Yep
its literally a few characters of code
u would have to
Or 3 if u want xomme
HttpURLConnection http = (HttpURLConnection) new URL("https://api.isevenapi.xyz/api/iseven/7234234242432").openConnection();
System.out.println(http.getResponseCode() + " " + http.getResponseMessage());
http.disconnect();
vs
num % 2 == 0 ? even : odd
i do
Doesn’t work, try setting it up how I set it up and check it please cause I have no clue how to get it to work
+free
it’s great if you want a reliable way of calculating if something is even
you have to createDir()
...
then
createFile()
then
createConfig()
in main class
also
read this
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
it has a tutorial
on how to make custom config files
Do you need help with that util I sent you I feel like no one I send it knows how to use it
Yes I do, I didn’t ping u earlier cause I thought u was in a different time zone and didn’t want to annoy or wake anybody up
I'm us cst
I’m us est
Anyways if you want to make nested directories first you create the dir than get the config like so usually I use constants to get my config names quickly
configUtils.getConfigFile("dir/config.yml");
Guys I've a problem. I'm using this API to retrieve some data https://github.com/SpigotMC/XenforoResourceManagerAPI
Problem is that I'm retrieving cached data (I've even tried with my smartphone on 4G and I'm still getting old data) probably there is some cloudflare server that is providing me old data. Does anyone know a solution?
All that data is cached. It's updated every 6 hours I believe
If I use a VPN it retrieves the updated data
Ok now how would I get like config.yml and I want to get gmc/message
Wdym explain
One secondet me boot up my pc I wanna cry typing code on mobile
player.sendMessage(config.getString("something"))
^ thi
cry 'bout it
Got it
Do configUtils#getConfigFile which retuns a FileConfiguration object
Than it's the same as any bukkit config you've used before only difference with the util Is creation really
If I have a seperate class for a listener, how do I get stuff from my configuration file?
Does it exists a header param that tells cloudflare to get the response only from the origin server and not from their cache?
Decency Injection
maybe learn some more Java too
?di
Guide to dependency injection: https://www.spigotmc.org/wiki/using-dependency-injection/
decency
we all need some of that
Cannot resolve method ‘getString’ in ‘utils_config’
Hello, this may sound like a really dumb question but can I get a variable from a class to another ?
sorry i'm a beginner
?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.
?di
Guide to dependency injection: https://www.spigotmc.org/wiki/using-dependency-injection/
I've checked and after 6hours cloudflare clear its cache
Cannot resolve method ‘getString’ in ‘utils_config’
can barely see anything
Hello how I can load on bungeecord configuration file from a resource file of my plugin to save it in the config.yml file of my plugin data folder ?
File file = new File(AsiluxAPI.INSTANCE.getDataFolder(), fileName + ".yml");
if (!file.exists()) {
try (InputStream in = this.getClass().getResourceAsStream("config.yml")) {
Files.copy(in, file.toPath());
} catch (IOException e) {
e.printStackTrace();
}
}
I do this in my FileYML class but that not work !
is there an onUpdate method?.. somth that updates every tick?
or every 5 ticks?
that 5 ticks is a bad attempt at optimization
Because it's load the config.yml of the bungeecord server with a ConfigurationProvider.getProvider(YamlConfiguration.class).load(new File("config.yml"));
nvm found it.
You can use a schedule repeating task
Dang was to slow :p
hey ty anyways!
im trying to make 4s ranked hypixel scenarios practice
and i need to check if 4 players have joined best way to do this prob what i sent
thx
add me
Could anyone explain why i'm getting an error there java Basic b = new Basic(); inv = b.getInv();
this is the getInv() java public Inventory inv = Bukkit.createInventory(null, 27, "§6Gamemode Menu"); public Inventory getInv() { return inv; } public void setInv(Inventory inventory) { this.inv = inventory; }
show the class u write that in
public class kiwiListener implements Listener {
Basic b = new Basic();
inv = b.getInv();
@EventHandler
public void onClick(InventoryClickEvent event) {
}
}
nothing much yet
nice
outside of a scope
lmao
this code makes no sense
well i just created it
?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.
it would kind make sense if it was wrapped inside ```
static {
}
block
you are assigning inv to a variable that does not exist
depends on what are you trying to accomplish
but still inv doesnt have a type
u dont need static
I'm so confused how the getter/setter works, i'm trying to send the var inv to another class
learn java
simple
well I am
this ain't python :P
well I come from python sorry ^^'
thats why i dont recommend python to beginners
class only uses python
python is absolute shit
it's good for ai
topic for another conversation
if u learn it u will struggle learning other languages
well other than ai and ml
its ass
it has their use cases, which are not really for dev and more for non-dev people, data analysts, sysadmins, etc.
anyways sorry for that
Hard to switch
although i'm pretty good at js, java seems super hard
it ain't hard, just very verbose
(pretty good at my scale)
you have to keep a handful of things in mind while coding, not like other languages
exactly
I'll get used to it
wait, now that I corrected it using java Basic b = new Basic(); Inventory inv = b.getInv(); Did the inv correctly went from a class to the other ?
wdym?
you passed the reference of that instance from one class to another, if you were to make a reference check (==) between them it will give you true
the instance does not get copied when gets returned from a method or something like that
^^ if that's what you mean
Well my goal is to create the inv in my command executor, and modify it in the listener
i'm doing incredibly dumb stuff lmao
yep
just realized that was useless
I mean i earned knowledge so not entirely
knowledge is always good
[B]TITLE 1[/B]\n[LIST]\n[*]BugFix 1\n[*]BugFix 2\n[*]BugFix 3\n[/LIST]\n[B]TITLE 2[/B]\n[LIST]\n[*]Feature 1\n[*]Feature 2\n[*]Feature 3\n[/LIST]
does anyone know the name of this markup language used inside forums like spigot?
yey found, BBCODE
Does anyone know how I get 5 nearby chunks from a player with a packet
This is my current code but doesn't work perfectly
public void getChunk(Player player) { ((CraftPlayer) player).getHandle().playerConnection.sendPacket(new PacketPlayOutMapChunk(Chunk Bukkit.getPlayer(player.getWorld().getChunkAt(50, 50)), 65535)); }
hehe Bukkit.getPlayer(player.getWorld().getChunkAt(50, 50))
Okay this might be me forgetting a detail again, but why won't this work ? java public static void main(String[] args) { int i = 0; String[] modes = new String[] { "creative", "survival", "spectator", "adventure"}; String[] items = new String[] { "DIAMOND_BLOCK", "WHEAT", "GLASS", "WOOD_SWORD"}; for (String mode : modes) { //System.out.println(mode); ItemStack modes[i] = new ItemStack(Material.items[i]); } }
I'm trying to create ItemStacks from the name in the array modes
ItemStack modes[i] =
that is not going to work
Can't it create an itemstack using the name in the array at i ?
or using mode, but both won't work
?
i am really not sure what you’re attempting to do there
you can’t have dynamically named variables
that would just never work
implying that i = 0 here, modes[i] should be creative, meaning that the itemstack would be named creative
that is most definitely not how you name an itemstack
like the display name in game?
no
i'm just trying to create the itemstacks here to put them in the inventory
so I don't have to do all them manually but can create some sort of function doing it for me
isn't modes[i] equal to the string at i in modes ?
variable names are not strings
arg shit
you are not doing this properly
try making a map
and putting the name and itemstack there
would've done it this way in python, guess i'm not used to it yet
python is very different from java
why dont you just learn java
well yeah, try using a map
I need projects to learn java, watching tutorials can't get everything to my brain and I need practice, I believe spigot is a good way to practice even if a bit advanced
mmm
that’s fair
for(int i = 0; i < modes.length; i++) {
ItemStack modeItem = new ItemStack(Material.valueOf(items[i]));
}
but
am i imagining
and i would catch illegalargument exceptions
or do you have a public static void main in a spigot project
spigot loads the class that is extending javaplugin
creating a public static void main wont have effect unless you run the jar
okay for now i'm gonna make the 4 items by hand lmao
all this is too far from my skills just yet
What variable type should be an array containing ItemStacks, Inventory, Itemmetas...
you could make a map 🙃
Is ServerCommandEvent called whenever I use Server#dispatchCommand or just the commands that I execute from console manually?
look at the first sentence on the docs
public class ServerCommandEvent
extends ServerEvent
implements Cancellable
! This event is called when a command is run by a non-player !
since a command always requires a commandsender, this event would be called
well yeah and what I am asking is what exactly is non-player
declaration: package: org.bukkit.command, interface: CommandSender
these
AbstractArrow, AbstractHorse, AbstractSkeleton, AbstractVillager, Ageable, Ambient, Animals, AreaEffectCloud, ArmorStand, Arrow, Axolotl, Bat, Bee, Blaze, BlockCommandSender, Boat, Boss, Breedable, Cat, CaveSpider, ChestedHorse, Chicken, Cod, CommandMinecart, ComplexEntityPart, ComplexLivingEntity, ConsoleCommandSender, Cow, Creature, Creeper, Damageable, Dolphin, Donkey, DragonFireball, Drowned, Egg, ElderGuardian, EnderCrystal, EnderDragon, EnderDragonPart, Enderman, Endermite, EnderPearl, EnderSignal, Entity, Evoker, EvokerFangs, ExperienceOrb, Explosive, ExplosiveMinecart, FallingBlock, Fireball, Firework, Fish, FishHook, Flying, Fox, Ghast, Giant, GlowItemFrame, GlowSquid, Goat, Golem, Guardian, Hanging, Hoglin, HopperMinecart, Horse, HumanEntity, Husk, Illager, Illusioner, IronGolem, Item, ItemFrame, LargeFireball, LeashHitch, LightningStrike, LingeringPotion, LivingEntity, Llama, LlamaSpit, MagmaCube, Marker, Minecart, Mob, Monster, Mule, MushroomCow, NPC, Ocelot, Painting, Panda, Parrot, Phantom, Pig, Piglin, PiglinAbstract, PiglinBrute, PigZombie, Pillager, Player, PolarBear, PoweredMinecart, Projectile, ProxiedCommandSender, PufferFish, Rabbit, Raider, Ravager, RemoteConsoleCommandSender, RideableMinecart, Salmon, Sheep, Shulker, ShulkerBullet, Silverfish, SizedFireball, Skeleton, SkeletonHorse, Slime, SmallFireball, Snowball, Snowman, SpawnerMinecart, SpectralArrow, Spellcaster, Spider, SplashPotion, Squid, Steerable, StorageMinecart, Stray, Strider, Tameable, ThrowableProjectile, ThrownExpBottle, ThrownPotion, TippedArrow, TNTPrimed, TraderLlama, Trident, TropicalFish, Turtle, Vehicle, Vex, Villager, Vindicator, WanderingTrader, WaterMob, Witch, Wither, WitherSkeleton, WitherSkull, Wolf, Zoglin, Zombie, ZombieHorse, ZombieVillager
for bungeecord, dispatchCommand does not trigger anything and that why I am asking that
ik ik
i have to go to my bed but the music is soo good 🥺
alright, nvm. tested and it does
hey guys can anybody tell me how to work with gradle shadowJar?
i need to shade
api
Is it better to override loot tables or make new ones and drop them?
What are you confused about
add the plugin, make ur build task depend on shadow jar, swap ur api call in ur gradle build file to an implementation
and build
No you have to run the shadowJar task
u can or u can have the build task depend on the shadowJar task
which is what i do
Sure
My custom mob with pathfinders loses its "ai" if its spawned with no players nearby, but when a player is nearby and its spawned then it works fine. what could be wrong?
Create Class - https://paste.md-5.net/semuzocece.java
Summon method - https://paste.md-5.net/kihaxewaxo.java
yo i need desperate help rq
so im using worldguard and for some erason now no one at all can punch
or interact
ty
I've been bugging on this for few hours. Basically I want to modify a lore of an item, which I succeed elsewhere after debugging the same problem. But the problem is back and there is no logic into it...
My System.out.println returns the right value of the metadata but my setItem fails hard time (and I tried to give the Item to the player but it gives the old/wrong metadata)
Idk why I cant post image so here my metadas
Console: [Click to disable]
Ingame: [Click to enable]
Here my code:
System.out.println(newItem.getItemMeta().getLore()); // Works
bagGUI.setItem(x, newItem); // Fails```
I'll go sleep bbl in 7hrs
Is there a way to stop spawning phantoms for specific players?
how to make build task depend on shadowjar? and how to swap? can you show me example? i cant understand what i should to do
what about it fails?
There ain't any errors but in summary; my item in my GUI isn't getting updated after my .setItem() function despite that my Console saying that my var is right 1 line just before the .set
The problem happens when I open the GUI, when I click on my item, my other function which has very similar code, works perfectly and change the item correctly
add to ur build.gradle
tasks {
build {
dependsOn(shadowJar)
}
}
but format it better
bump?
Why not use entity spawn event and kill it?
How can i generate a command which works on pressing the gui button and changes everyting when clicked
So, I'm developing a BungeeCord plugin. However when I build it to a jar, it states that it is a trojan even though I'm developing the plugin... is this a known issue or just me?
same thing was happening to me earlier lol
idk why
good, I'm not the only one lol
is this a api that i can use?
if(player.getInventory().getItemInMainHand().getItemMeta().getDisplayName().equalsIgnoreCase(ChatColor.YELLOW+"The Wand Of the Gods")){
TextComponent message = new TextComponent("Spell-1");
message.setColor(net.md_5.bungee.api.ChatColor.BLUE);
message.setBold(true);
message.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND,"/summon zombie"));
player.spigot().sendMessage(message);
}```
It is suppose to send a clickable message to a player but instead when we click nothing happens and there is no console error
Where did you dig this out?
Its just a way of bridging commands to methods. You can use those classes if you want to.
It just builds a layer so you can have click actions that invoke a method instead of calling a command. (It still does as a bridge ofc)
Real quick question, can I make my method that listens to an event private, I can't remember if the reflection needs it to be non-private or not
It can be private
ok thanks just wanted to verify it
ok i will try it
i gave a tag to the items now how can i call it
When I enter bosstype "zombie" Why zombie doesnt spawn?
i know you are not asking that but just to inform that for enchantment more than the regular level you should use unsafe enchant
Did you tried to debug your code ?
By adding some sysout
Caused by: java.lang.IllegalStateException: Asynchronous entity add!
Don't spawn entities async
public void onClick(PlayerInteractEvent event){
Player player = event.getPlayer();
if(player.getInventory().getItemInMainHand().equals(Material.STICK)){
TextComponent message = new TextComponent("Spell-1");
message.setColor(net.md_5.bungee.api.ChatColor.BLUE);
message.setBold(true);
message.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND,"/summon zombie"));
player.spigot().sendMessage(message);
}
}```
This code should suppose to give a clickable text component when clicked but when i click it there is no text and there is no console error
An item stack will never be a material
You need to call getType on it. Also use == when comparing materials
Yes
if(player.getInventory().getItemInMainHand().getType()==Material.STICK){
TextComponent message = new TextComponent("Spell-1");
message.setColor(net.md_5.bungee.api.ChatColor.BLUE);
message.setBold(true);
message.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND,"/summon zombie"));
player.spigot().sendMessage(message);
}``` still the same result 😦
^^
@EventHandler
public void onClick()....
happens to the best of us
^ this
yah , sorry for irritating you
No worries
i want so that only the players who have a special stick should be able to use
and if one player cracks it then they will be able to access it without that stick
is there any documentation for uuid
Ye
thanks
No problem
can i ask something?
is it possible to control a variable from another class
i know its possible
but i am making a coin system
It can be private but you should not make it private because it may take a hit on performance.
i want it to store money of the players
i dont know what is static
So Im guessed a hashmap?
This is a very very basic concept in java. Take 2 weeks to learn the basics and you will find that this
is one of the simplest things you can do.
When you declare a variable static its class dependent instead of instance dependent
thanks
Player money
Can you share your source code?
i think i deleted it like a month ago i am making a new system
thanks :)
Np
If you would have taken the month to learn the java basics then you would be able to write a lot more complicated plugins now...
i am trying to learn it like 2 years without any tutorials because of my school i dont have enough time to learn thats why i dont understand
If you take only one hour each evening for 3 weeks learning the basics then you will have the knowledge to
learn the rest through spigot. "I have no time" is not an excuse. It just depends on how much you really want this.
You just need discipline to bite through the first boring hours.
thank you.
why this is working but if gives null
@EventHandler
public void onButton(PlayerInteractEvent e)
{
e.getPlayer().sendMessage(e.getClickedBlock().getType().toString());
if (e.getClickedBlock().getType() == Material.STONE_BUTTON)
{
Button button = ((Button) e.getClickedBlock().getState().getData());
Block block = e.getClickedBlock().getRelative(button.getAttachedFace());
if (block.getType().equals(Material.SPONGE))
{
RandomTeleportUtil.randomTeleport(e.getPlayer());
}
}
}
plugin yml api-version: 1.13
gradle
'org.spigotmc:spigot-api:1.8.8-R0.1-SNAPSHOT'
(first if is that null)
in what way...
how can i control a variable that's in another class that's in another package
by learning java
i did but..
public int money = 0;
Can't send dollar sign ($) in chat.
i think i'll look for a tutorial
that doesnt show that u know java
Hello, I'd need help with something. I have a command that requires an arg being a player in my command executor class, and I would like to send that player variable to my listener. I have no idea how to build that
Use a variable
^^
Yes, if its encapsulated properly
Like making a public player variable?
Yup
Oh
Well I'm dumb lmao
Sorry for that, idk Google told me to use getters/setters but I got confused on how to use them since it's functions and not variables
Thanks a lot
what if two players did that at once
Well I can just save it in my listener since it'll open a gui
Like I need to use the name from the gui afterward
I believe it'll work
whats ur main target
oh okay
sure
How can i place a block?
I tried this:
location.getBlock().setType(Material.CHEST);```
But this runs into an java.lang.NullPointerException
Probably because Method invocation 'getBlock' may produce 'NullPointerException' but how can i fix this?
for (String key : cfg.getKeys(false)) {
Location location = cfg.getLocation("key");
location.getBlock().setType(Material.CHEST);
}
}```
The problem is that im not reading the right way out of my configfile
Version 1.8(please dont shout at me)
Main File:
package hypixelrankedswscenarios.lumina.hot.sexy.Lumina.hot;
import hypixelrankedswscenarios.lumina.hot.sexy.Lumina.hot.commands.Join;
import org.bukkit.plugin.java.JavaPlugin;
public final class Main extends JavaPlugin {
@Override
public void onEnable() {
// Plugin startup logic
System.out.println("RankedSW Scenarios was loaded success fully");
this.getCommand("Join").setExecutor(new Join());
}
}
show config
show plugin.yml
Locations:
Chest1:
==: org.bukkit.Location
world: world
x: -14.51230229856377
y: 16.0
z: 1.4775778660855778
pitch: 86.39996
yaw: 9.903734
Locations:
Chest1:
==: org.bukkit.Location
world: world
x: -14.51230229856377
y: 16.0
z: 1.4775778660855778
pitch: 86.39996
yaw: 9.903734
what is ==:
Show the getLocation method in cfg
alr
Show the getLocation method in cfg
don't
why?
api-version was introduced on 1.13 and will cause an error on a lower version
ooh i am sorry
yh
yeah 1 sec
imagine censoring it
xd
it includes my real name
hey guys a small question, does spigot api support blocks in air falling down and stuff?
i remember there is a server where blocks move downward in fastbuilder and goes up to form the lobby
snapshot build
i might have asked wrongly
i see
ill give a small clip of this i found in some update vid of a srv
u know u can just collapse the target folder
too lazy
Your question can be rephrased as
Make non-gravity-affected-blocks fall like gravity-affected-blocks (sand etc)
~ Server IP: bridger.land
~ Hosting GIVEAWAYS on https://discord.gg/bridge
#prison
Tags! Just ignore them :)
minecraft,minecraft prison,prison,minecraft prison escape,prison escape,minecraft roleplay,minecraft prison server,prison break,minecraft op prison,minecraft prison break,minecraft mods,minecraft jail,minecraft prison ali aminecraft,mine...
like this
nvm i just misspelled hypixel in spigot.yml main:
maybe
u can do thatw/ cmd blocks
how
spawn a falling block
it will take extra time setting up
and remove the old block
idk but i think u can summon a alling block and change its tyep using [type=]
no, they want to for example, they want to make a stone bllock act same as sand
falling*
when a block is updated, check if theres air underneath
i think mysticat was using this
if so, remove the block, spawn a falling block at the location of the block and set its type to the type of the block
lemme fian a vid rq
and then? how to make itfall
ohh
^
@rapid rock ^^
issue the command using Bukkit
yes u can
final Set<Material> blocksToFall = new HashSet<>();
/* on block update */ {
if (!blocksToFall.contains(block.getType()) return;
// get properties of block
BlockData data = block.getData();
// remove block
block.setType(Material.AIR);
// spawn falling block
block.getWorld().spawnFallingBlock(block.getLocation(), data);
}
``` like this
@rapid rock
issueing commands will be slow as fuck
or if u wanna use the cmd block way use
.
yes and you never want to use that
YES
yh use spigot
u can do everything u do with cmds, using the spigot api
- it has to parse the command
- you have to insert all information into the string like location
btw can u send ur intellij theme
okk tyy
1 of theese 2 the theme is Atom one dark vivid italic @golden kelp
idk
aight
but its one of them
ok
is there anyway to have an emoji system like hypixel's without having to call replace a billion times for each message?
Sorry to interrupt but is there a way to modify chunks instead of creating it from scratch?
- custom emojis
chunks? like the blocks in it?
Yes
u can loop through ig but its gonna be very heavy
ig i should probably use StringUtils then right?
yeah but replace takes a long time
you can use regex to get the values inside :: i think
ig thats the only way
then you can map them directly
instead of calling replace for each emote
like hello :bobux: amogus :sus:
sus
will directly give bobux and sus at the right locations
Maybe having a map for each word and replacing the ones that match with an emoji and rebuild the message?
is what youre sayin?
yes
i would just iterate & check if it contains that, if not, skip
will be faster on a larger scale
imma do a benchmark with String#replace StringUtils#replace and the map thing
k but the map thing might be hard
Loop?
Basically I want to generate a block at y =< 10, For example 1 iron block per chunk.
It would be painful to redo every type of chunk from scratch, Is there a way to replace blocks instead?
So, i tried building a plugin project but it didnt give any .jar files and some folders in the target directory, can someone help?
how did you build the project ?
are you not using maven or gradle ?
im using maven
i have it
with my plugin name? if yes i have that
Yea
i double clicked that
ah, i thought the hammer or the build project was the one i need to do, the run button builded it
did it work ? 😅
yeah
sweet
mvn install
I mean, generally mvn package is enough
no, in some days he will back asking help to use the project in another maven project
i use gradle btw
typical gradle user future sight
no
imagine using xml 🤣
Mvn meh, gradle bad
maven >>
^^
imagine using gradle wrapper --gradle-version more then your build command
xdddd
simplest gradle setup
apply plugin: 'java'
targetCompatibility = '17'
sourceCompatibility = '17'
group = 'group here'
version = 'version'
repositories {
mavenLocal()
mavenCentral()
}
And even that command does Not Always work
what was that?
spam
scam
free nitro huh
imagine using cli when you can use an ide
id love that, theres no way its not legit
imagine using an ide when you can use the cli
no xd
I personally started to use my own fork brachyura, it's rather nice. But having to maintain Fabric and Quilt support is too tiring after some time especially If you do Not use it and normal Java Support is Not implemented despite the devs saying otherwise
So you'll be maintaining the fork more than you'll actually use it
And getting rid of the support will backfire I am afraid
if on windows, delete system32
You shouldve tried rm brain.exe but it will throw NPE
who puts flags after the argument
me
I mean, I guess that is in line
Yeah, Flags in front
-DISwearIKnowWhatImDoing
hey guys, here anyone know how to minimizeJar in maven project contain sub-module?
<modules>
<module>bungee</module>
<module>spigot</module>
<module>Both</module>
<module>global</module>
</modules>
exclude them?
I use global-module to output my jar
maybe you have a target folder for each module
<dependencies>
<dependency>
<groupId>org.tjdev.util</groupId>
<artifactId>spigot</artifactId>
<version>1.0-SNAPSHOT</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.tjdev.util</groupId>
<artifactId>bungee</artifactId>
<version>1.0-SNAPSHOT</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.tjdev.util</groupId>
<artifactId>both</artifactId>
<version>1.0-SNAPSHOT</version>
<scope>compile</scope>
</dependency>
</dependencies>
Here are dependencies
yes
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.3.0</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<relocations>
<relocation>
<pattern>de.themoep.minedown</pattern>
<shadedPattern>org.tjdev.util.colorful.additional.minedown</shadedPattern>
</relocation>
</relocations>
<filters>
<filter>
<artifact>org.tjdev.util:*</artifact>
<includes>
<include>**</include>
</includes>
</filter>
<filter>
<artifact>*:*</artifact>
<excludes>
<exclude>META-INF/**</exclude>
</excludes>
</filter>
</filters>
<outputFile>${project.basedir}/../../Jars/TJPluginUtil.jar</outputFile>
<createDependencyReducedPom>true</createDependencyReducedPom>
<minimizeJar>true</minimizeJar>
</configuration>
and It's my shade config
with gradle and shadowJar, only implementation dependencies are shaded
maybe you could find an alternative for maven
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>31.1-jre</version>
<scope>compile</scope>
</dependency>
I have use guava in my sub-module "both" it contain bungee and spigot feature
ok
But minimize jar won't work so now the file is big
uh that requirement but I want exclude useless file in that.
you can use the provided scope
that isn't contain in spigot
i think guava is a spigot library
Hmm
you could use provided for that
What is the best way to determine servers when sending redis publish / subscribe? I mean e.g. which server sends the message to the proxy and vice versa.
Let me see
https://paste.md-5.net/isuwegazoq.java
any tips to improve the last one?
also @glossy venture was the last one what you meant with map?
yes
alr
idk what you could improve it looks good to me
in fact that's meaning "both" so it need support bungee too
But I don't think bungee had guava
why would you need a bungee logic in a spigot plugin
Ya one issue is that it wont detect things like :emoji:fdbgjnkl
why not?
I can use one util or I need to use two project
if you are developing a spigot plugin you will use only spigot utils
same for bungee
you could read the string
ok I'll show you
using a StringCharacterIterator
so there is no need to merge them in 1 module
Hm?
and check for :
public static Set<Class<?>> findAllClassInPackage(String packageName, ClassLoader e) throws IOException {
HashSet<Class<?>> c = new HashSet<>();
ClassPath.from(e).getAllClasses().stream().filter(clazz -> clazz.getPackageName().equalsIgnoreCase(packageName)).map(ClassPath.ClassInfo::load).forEach(c::add);
return c;
}
That's it
This code work in bungee work in spigot too
so I called it both
might be a little complex
show me the both pom
I made a command that spawns mobs and I was wondering how do I make it so that minecraft auto completes me. like when I use /spawn I can see in chat that it wants me to input an entity and it gives me a list of entities. Can anyone explain me how to do that?
if (args.length >= 2) {
try {
EntityType entity = EntityType.valueOf(args[0].toUpperCase());
int amount = Integer.parseInt(args[1]);
for (int i = 0; i < amount; i++){
player.getWorld().spawnEntity(player.getLocation(), entity);
}
} catch (IllegalArgumentException e) {
player.sendMessage(ChatColor.RED + "That is not a valid entity");
}
} else {
player.sendMessage(ChatColor.RED + "(!) /spawnmob <mob> <amount>");
}
}```
do you need :amogus:amogus to work
ok
prob not
k then this should be ok
guava is a google library
and its probably not worth losing the maintability cuz im 99.9% sure even if i make that work i wouldnt be able to fix anything with it later on
its just included with spigot
can anyone help me please?
but not bungee
Maybe I should use smth else for split?
tab completer or something
That's hard to understand
implement your command class tabcompleter
there is an interface for that
I don't understand
public List<String> onTabComplete(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, @NotNull String[] args);
uh
make ur command class implement tab completer
public class Example implements TabCompleter, CommandExecutor {
@Override
@Nullable
public List<String> onTabComplete(@NotNull CommandSender sender, @NotNull Command command, @NotNull String s, @NotNull String[] args) {
List<String> r=new ArrayList<>();
//check and add into r
return r;
}
}
like if args length is one and I want to add a reload command
then
if(args.length==1){ //it like "/plugin <detect here"
if("reload".startsWith(args[0])) r.add("reload");
}
so you can solve it or not:/