#help-archived
1 messages · Page 90 of 1
I meant physically gets broken, not uses its breaks
I rest my case.
How can i put my proxy on the same server as my lobby?
wdym same server?
you canot asbest
if you mean running bungeecord and a spigot server together, like on 1 shared host you probably cant
I mean if you have a VPS you can run it on the same host
or just a dedicated host, or self hosted for that matter
but if you're talking about traditional minecraft hosting like mcprohosting you can not you'll need to buy multiple servers
How do you do tab autocomplete errors and red text?
The method just returns a list
If you type /gamemode bad, the "bad" is in red and there's an error above it
I want to do that for custom commands
Hello !
This occured
com.mysql.jdbc.PacketTooBigException: Packet for query is too large (4739923 > 1048576). You can change this value on the server by setting the max_allowed_packet' variable.```
When I do
```Java
private void connect(){
try {
Class.forName("com.mysql.jdbc.Driver");
this.connection = DriverManager.getConnection(this.dbCredentials.toURI(),
this.dbCredentials.getUser(), this.dbCredentials.getPass());
Logger.getLogger("Minecraft").info("Succesfully connected to the DB.");
} catch (SQLException | ClassNotFoundException e) {
e.printStackTrace();
}
}```
I tried to set this "max allowed packet"
But nothing changes
@hollow thorn if you want something to happen later, use the scheduler. Otherwise you'll block the main thread and nothing will happen on the server while you wait.
It doens't matter which class you use it in, it matters which thread you're in
The server runs on (mostly) one thread. So unless you explicitly scheduled an asynchronous task, you're likely on the main thread
so as long as its not in the main
The main thread - again, the class is not important
@pastel fox Check out this thread: https://www.spigotmc.org/threads/acf-beta-annotation-command-framework.234266/page-17#post-3771974
@hollow thorn I feel I need to reiterate this. Just because you're in a different class, does not mean you're on a different thread.
No
That's what I'm saying
The server runs on (mostly) one thread. So unless you explicitly scheduled an asynchronous task, you're likely on the main thread
public class StaffWeaponUse implements Listener {
public class StaffWeapon extends JavaPlugin {
You're on the main thread.
are those the same thread
Yes
Ask yourself "Did I explicitly call an async thread?" - if the answer is no, then you're on the main thread
when i do
this
while(loc.getBlock().getType() == Material.AIR) {
loc = loc.add(loc.getDirection());
world.spawnParticle(Particle.FLAME, loc, 0);
world.playEffect(loc, Effect.BLAZE_SHOOT, 4);
for(Entity ent : getEntitiesByLocation(loc, 0.545f)) {
if(ent instanceof LivingEntity) {
((LivingEntity) ent).damage(10, me);
((LivingEntity) ent).setFireTicks(10);
}
to make a gun
@wraith thicket Probably has never heard of timestamps
I mean you can use timestamps/scheduler @hollow thorn , depends on what you doing
i was making a plugin
Youre just confusing people lol
that adds in ranged weapons
i was just wondering if i could use a similar thing
for cooldowns
this guy doesnt know nothing about threads lol, just point him in the right direction instead confusing him with threads @wraith thicket
I mean what exactly are you trying to accomplish, explaine me please @hollow thorn
no u were talking something about threads
oh i wasnt trying to achieve anything
huh?
but i was just trying to help with the cooldown thing
bruh you havent even provided any info of you current code and more in detail what are you trying to achieve so we cant help you atm
oh no the code there was fine
i was just trying to help with
the cooldown
because when i use the gun
it doesnt stop everything elese from working
as far as i can tell
Fire it towards the air and see what happens
They probably shot towards some mountain or something - iterating like 100 blocks and then stops because it hit a non-air block
Or, actually, even the sky uses VOID_AIR I think
Yep - that's why the while loop terminates (the VOID_AIR bit, that is)
As for a cooldown, generally you want to do it per player. What you'll do is make a mapping from the player's UUIDs (not the player object nor their name) to the time at which their cooldown ends. And when a player tries to use/do whatever is on cooldown, you check if their UUID is in the map and if it is, check if the current timestampe (System#currentTimeMillis) is higher than what's in the map
I don't think the regular /enchant command does that, ray - but you can simple use one of the countless online /give command generators to give yourself a sword with sharpness 100
public final class Main extends JavaPlugin {
private final Map<UUID, Long> players = new HashMap<>();
@Override public void onEnable() {
Bukkit.getPluginManager().registerEvents(new Listener() {
@EventHandler
void onLaunch(ProjectileLaunchEvent event) {
if(event.getEntity() instanceof Arrow && event.getEntity().getShooter() instanceof Player) {
Player player = (Player) event.getEntity().getShooter();
if(isOnCooldown(player) {
player.sendMessage("Youre on cooldown");
return;
}
//Your gun here
}
}
}, this);
}
private boolean isOnCooldown(Player player) {
if (players.containsKey(player.getUniqueId())) {
if (players.get(player.getUniqueId()) > System.currentTimeMillis()) {
return true;
}
players.remove(player.getUniqueId());
}
return false;
}
private void addToCooldown(Player player) {
players.put(player.getUniqueId(), System.currentTimeMillis() + 1000L * secondsL;
}
}
@hollow thorn
I mean youtubers can do it
ItemMeta#addEnchantment
Actually, enchant <user> <enchantment ID> <level> [force] according to https://bukkit.gamepedia.com/CraftBukkit_Commands
So you should be able to specify froce in the end to force the level
Where are upload my plugin?
Thx
@atomic rapids sorry for mentioning but i changed my name on spigot mc how can i change my name on this discord? (the nickname)
Where are upload my plugin?
@frigid ember you make plugins? What is the plugin about?
Why?
I don’t know I just want to know it
I making my 5.plugin Hide Pluger
Ok
what is your name on SpigotMC @frigid ember
@atomic rapids how do I sync my Discord name with forum name
yeah i had same question a few minutes ago @obtuse rose
oof sorry xD
My old name was too cringy
I mean "current", it was 6 years ago or so lol
plugin config perhaps?
In notepad++
Depends what plugin he's using.
"I think"
@wraith thicket ty!
Everytime I interact any block it says on chat "You don't have the permissions" with red color
Please help me
No I haven't
Wait please
👍
I'll send it on dm
123 plugins 💀
Some people just want to watch their cpu burn
Is someone here willing to teach me how to give someone speed when they join the server?
@frigid ember as in make a plugin to do so?
edit the .jar i think
Player#setWalkSpeed(0-1)
are you making your own plugin?
and do you want to give the potion effect or set their speed? (different)
potion effect
compile a plugin, learn events then you can use my method
or walkspeed
ok
fsr i thought it had to do something with the actual server .jar file
nah nah
How do I make a zombie hanger on spawn?
if(event.getEntity() instanceof PigZombie){
String piggyname = ChatColor.DARK_PURPLE + "" + ChatColor.BOLD + "Angry Zombie";
LivingEntity piggy = event.getEntity();
piggy.setCustomName(piggyname);
piggy.setCustomNameVisible(true);
}
I have this code for jump pad plugin, but at the moment it only actually works when the player is on creative although I don't ever check that
https://hastebin.com/revofowuzi.cpp
hello can I downgrade a world from 1.15.2 to 1.14.4 pls answer
tag me when answer as I am going offline
hi everyone i have a problem with an anticheat module that i am creating you can help me
@icy cosmos ...
How do you see if a player has an item with metadata in their inventory, cause
if(player.getInventory().getItemInMainHand().getItemMeta().equals(randomItemMeta))``` only shows for main hand, and not whole inventory
sorry, I'm a bit of a noob :/
loop through the inventory and check each item?
@hidden mica
for(ItemStack item : player.getInventory().getContents()){
if(item.hasItemMeta()){
//do stuff here
}
}
This should do it
Thanks!
Hi, how are you need help me staff
Speak only english or spanish ¿?
download Citizens link please <3
Yo hablo español que te pasa
https://www.spigotmc.org/resources/citizens.13811/
Versión 1.8
😂
is GameProfile only available with NMS?
whats that?
oh yeah nvm my bad, it's inside com.mojang.authlib
but Is it possible to access it without implementing NMS code as a dependency into my project?
Possibly thinking about reflection
how can I retrieve a list from a yaml config file ? There's the method getList but I don't know wich type it returns
it returns a List<?>
it returns whatever it has in that list's type
And what is wath is in the list's type ?
leaderboards:
- leaderboard:
name: "main"
objectives:
- objective:
name: "kills"
display-name": "Nombre de kills"
- objective:
name: "balance"
display-name: "Argent"
the list is leaderboard
Is there a guide for creating your first plugin?
seralizable objects i suppose
or at least how to set up spigot
no, it's not serializable
then you can't make sure of that
unless you store primitives
and their boxed versions
which are serializable
there is on spigot wiki @obsidian pulsar
Hi everyone i have a problem wiht an anticheat
I've been having major issues getting a built in resource from the JAR file once it's built.
All I'm trying to do is copy the embedded file to the plugin's directory, but no matter what I do, getResource() returns null at some point. Even getResourceAsStream() is returning null.
Even if I move the file and the class I'm using to the same package, they return null. Any ideas??
Show some code
I know that getProtectedDomain() sometimes is useful
iirc
i think thats the method name
Tried that, didn't work either.
It's in the same location as the class I'm accessing it from. So even if I do getClass().getResource("test.txt") it doesn't do anything
lol
yeah so resource files dont go in the same directory as java files
your project layout should be
src/main/java
src/main/resources
getResource will look for "test.txt" in
src/main/resources/test.txt
The layout should be like that even if I'm not using Maven/Gradle?
yeah, it's conventional.
Why would IntelliJ not lay it out like that if that's the case
It does, but normal Java projects aren't laid out that way by default even though they should be? 🤔
Well, maven set the standard and gradle followed up with it. Prior to that the convention, which is still used, is the model to use your website URI reversed.
I.e
com.google.myproject
Yeah that's what I've been using
sec
gradle follows this too
for unit testing you do
src/test/java
src/test/resources
or microbenchmarking
using JMH
if you created the project with Eclipse/IntelliJ, by default resource and source code folder were the same folder though?
i have intellij ultimate, if i create a java project with maven or gradle as dependency management it will create src at top level, followed my main/test follwoed by java/resources respectfully.
that's when you use maven/gradle
I'm not using those. IntelliJ Community does the same thing.
yeah so a baseline java project sure, why give the additional boilerplate
better to do things conventionally
unless u want to work alone forever
just use maven/gradle, problem solved 👍
Not a fan of them.
and it's easier for other people to collab too
because compiling is just a command
instead of download tons of stuff and add to project manually
Gradle isn't too bad, IMO Maven is a complete disaster.
I generally do personal projects, so there's no reason for me to put them on Github, so those don't really have a point
Maven has nothing to with github
Gradle to an extent, yes
so u would rather use nothing for dependency management
then gradle or maven
or do u use an alternative
or do u stick .jar files in a folder called /lib/ and call it a day
^ pretty much yep
yup
maven is super easy
they provide a 5 minute (really 20) on maven essentials
then u can spend a few hours indepth on their larger tutorial
then ur smooth sailing
Idk why but my maven never worked. I obviously did something wrong and just couldn't be asked to figure it out
then u get the benefits of aggregation and inheritence
i have entire book on maven
Everything is easy nowadays. You just google it.
if maven never worked for u
u aint working for maven
communication is a 2 way street my dude
If I'm going to use a dependency manager I would just use Gradle. Is there a reason to know both 🤔
yes
how could you decide to use gradle if u dont know maven
grass could be greener on the other side
I'd say using one is a bigger step than knowing both.
(its not)
atleast use oone -_-
Lol i love this kid on spigot he got book banned from his own server and made a post on spigot asking about the bobbing xD thinking it was a glitch
I hate like everybody thinks they can just run a server even though they arent qualified
@hallow surge tbh, isn't that like the majority of people on SpigotMC forum?
im not qualified thats why I dont try to run my own server xD
@obtuse rose it really gets on my nerves when they dont even know mc in general
not only do you not know how to program you dont know the game
😆
like okay your new to program but atleast know the game
you would still need a bit of basic networking/programming stuff to run a server though
but those people who just download everything, throw it in plugins folder and call it a day....
I totally agreed with you @hallow surge 😅
that's entertaining ngl xD
am i able to get rid of this player stuttering lag?
looks more like ping
@cloud sparrow they have 80 ping
Is there any way to remove the console output from a lightning strike?
Bukkit.getWorld("world").strikeLightning(Location); // This gives "Summoned new Lightning Bolt" in console.
i think its just the effect
It would trigger the event?
so no it won't show
but if I trigger the effect it dsnt burn/damage etc right?
nope?
Can I give NBT tags to players (like {tag=true})? Or do I need to muck around with player data for that?
So I can use NBT?
What are Nbt tags
👌
choco check this out https://www.spigotmc.org/resources/disablerespawnscreen.66730/
lmao
Because fuck open source, right?
.-.
lel
Report the resources that don't abide by the obfuscation regulations
oh k
or you could like
This Discord is not the place to report them
well he even has a premium one
yeah
Seems to be the type of person to write a basic resource in 5 minutes and upload it
def
and then for some reason he is having an expensive obfuscator
does Collection<? implements ConfigurationSerializable> implements ConfigurationSerializable ?
looks like stringer 3.0.0 which has been cracked
LMAO
obfuscate is not allowed? (just asking didnt know)
Read the rules
i think just basic name obfuscation is allowed
but that guy has like control flow/ string obfuscation and what else it's using
Right, so
Report the resources that don't abide by the obfuscation regulations
Resource staff will tend to it lol
lol
does Collection<? implements ConfigurationSerializable> implements ConfigurationSerializable ?
or how can I retrieve the value of a list in a yaml configuration file ?
oh, yes, you're right
but to what should I downcast the item I'm referencing ? Map<String, Object> ?
I have the following yaml file
leaderboards:
- leaderboard:
name: "main"
objectives:
- objective:
name: "kills"
display-name": "Nombre de kills"
- objective:
name: "balance"
display-name: "Argent"
it's different because It doesn't represent a scoreboard that can be displayed by the side like the minecraft ones
whut
I display it with holographics display
and?
so I can't use the org.bukkit.scoreboard.Scoreboard Interface 🤔
No? But you can still use the built-in yaml system in the api?
yes... I implemented ConfigurationSerializable, but now how can I deserialize them ?
Certainly that provides you the most essential features of conguring
doesn't a method exist for that?
wait send ur code?
You deserialize them as everything else
for (Object o : conf.getList("leaderboards")) {
Map<String, Object> map = (HashMap<String, Object>) o;
String name = (String) map.get("name");
}
but I don't know how to get the second list
get() and cast, or getSerializable() for a generic version
getList() should also be castable
I'm new to spigot So i don't know very much about it
but how can I get the second list ?
you can't ?
- objective:
name: "kills"
display-name": "Nombre de kills"
- objective:
name: "balance"
display-name: "Argent"
I think the fact that it's a list to begin with is a design flaw
It should be a section
using a key twice will mess it up ?
maybe, I can modify it
what is a section ?
a key holding a map
leaderboards:
nameOfLeaderboard:
objectives:
kills:
display: "Number of kills"
balance:
display: "Money"```
^
That's how I'd do it
ok
and how can I retrieve the name "kills" and kills.display, for example ?
Hello guys, i need help
how to make chunks that do not discharge with the passage of a player from one chunk to another
FileConfiguration
.getString("leaderboards.nameOfLeaderboards.objectives.kills.display")
Knovobo wym by discharge?
the fact is, that y a can have an arbitrary number of objectives
so how can I iterate of them ?
getList returns a List<?>, and I don't know to which type I have to cast it
ConfigurationSection has a getKeys() method to get the set of keys
It's a set of strings all being the entries in that section
ok, thanks
basically, I made a plug-in to modify the knockbacks on my server but each time a player knockbacks from one chunk to another, the chunk unloads and reloads and it becomes a chunk corrupted with restart :/
@naive goblet
Was thinking to simply changing to local ints
so i only work with config every once and then..
no, when 2 players fight and they change chunks, I would need a code which allows that the chunk does not move
the problem happens when a lot of people fight in the same chunks
and after restart
hello
i came back wanting to know if anyone still knows how to cancel an incoming packet from a clientnwith metty
netty
or is the only solution letting it succeed and ignoring it
i want the client to know that the packet has been canceled with the channel.writeAndFlush(packet).isCancelled()
when they send it
or isSuccess() isk
idk
is this possible, i am using netty 4.1
What are you doing
attempting to cancel a packet with netty
in the channelRead(ChannelHandlerContext ctx, Object msg)
idk why many people like context about why i do stuff but fo example i dont want clients spamming me with packets
maybe have a limit per second and the rest cancel
You're going to compromise the experience of your users by doing that
or if data is not readable cancel or select what i want
in my client and server it is not bornal for the user to randomly spam packets
that was an example
a good example maybe with minecraft is cancelling a position update @subtle blade
the client must know so he can teleort back
Is this a good way to keep chunks loaded that I really need loaded? [1.8.8]
@EventHandler
public void onUnload(ChunkUnloadEvent e) {
if(chunks.contains(e.getChunk())) {
e.setCancelled(true);
}
}```
is there a way than doing extra work server side and sending a packet to the client saying “cancel” that packet for example
Really?
yup
woah
can i get a response quickly man i really gtg
i don't know how the unload works if it got cancelled
Should I just loadChunk?
and setCancelled
just incase
@EventHandler
public void onUnload(ChunkUnloadEvent e) {
if(chunks.contains(e.getChunk())) {
e.getChunk().load();
e.setCancelled(true);
}
}```
choco???
if you have the chunk instance that means its loaded
pretty sure of it
unless is a leftover chunk instance ie after an unload
no it's fine
kk
it will work
Mbe do a Set<> with a custom object which only has a x,z
Max chunks per player might be like 2-4
ok
set uses more ram and has better cpu while arraylist is the oposite
i dunno it can always get improved so :p
Rly think you should do an custom object with x,z variables there, unnecessary to store the whole chunk in a Set
choco im actually pissed now u made me wait so long why respond and then for no reason leave
just pop off
a good example maybe with minecraft is cancelling a position update @subtle blade
[4:46 PM]
the client must know so he can teleort back
This is EXACTLY why we have events
now u respond
Also, I'm not entitled to support you. There are literally 6,300 members in this Discord
Because I had been available at the time and was not afterwards
as the others didnt really comment i assume they don’t know
events are called by packets
i guess
The reason I ask for context is because often time people overcomplicate things for seemingly no reason
Everything on the server is handled by the client sending it packets
Depends on the event
playermoveevent
It sends back a packet to the client telling it not to move
There is?
wont it kill the server
if the derver does extra worki telling the client to stop
200 players with timer
It's meant to handle and distribute packets
server will die
It won't
You're severely underestimating the amount of packets that get sent at any given point
One mere packet will not do a single thing
when i debug all minecrafts lackets why dont i see this
why dont i see the server sending a packet not to move
because it sends a teleportation packet
CANCEL THE FUCKING EVENT, RETROOPER
lmao jesus christ
you don't need to sniff for packets
It's unnecessary
Client sends packet to move, server doesn't respond. Client assumes it's right, server thinks its in another position, server kicks player
The server has to send a packet
That is how it is cancelled
i thkught there was an inbuild way to cancel and the server wont deal with the packet
You're not going to out-smart the server
The events exist for a reason
It's to make your life easier
idk what you mean out smart
f1 doesnt hide nametags anymore?
i just used bukkit events as an example so you know what i meant
hmm @subtle blade does playerdeathevent gets called even if the killer is an arrow?
by that i mean the getKiller will return null in that case?
new BukkitRunnable() {
@Override
public void run() {
CompletableFuture<String> future = generateTopTenMessage();
future.thenAccept(message -> cachedTop = message);
}
}.runTaskTimer(instance, 0L, 300 * 20L); // every 5 minutes
private CompletableFuture<String> generateTopTenMessage() {
CompletableFuture<String> future = new CompletableFuture<>();
database.executeQuery(data -> {
StringBuilder sb = new StringBuilder();
int place = 1;
while (data.next()) {
sb.append(messages.getLine("topten.place", Messages.getPlaceholders("%place%", "%name%", "%shards%", String.valueOf(place), data.getString("name"), String.valueOf(data.getInt("balance")))));
place++;
}
future.complete(sb.toString());
}, "select name, balance from shards order by balance desc limit 10;");
return future;
}
The more I look at this, the more I think it's blocking
is thenAccept blocking the main thread or am I good
No its your completablefuture
Do CompletableFuture.supplyAsync(() -> { return value; });
the future is completed in an async callback
that's not my concern (at least, I don't think so)
What is the way to get if a player is standing on a honeyblock?
anyone tried using https://mariadb.com/kb/en/about-mariadb-connector-j/ or any other connector?
i keep getting exception java.lang.NoClassDefFoundError: org/mariadb/jdbc/MariaDbPoolDataSource, but i added the .jar to the classpath
and imported into class
is is because of the creating normal java threads(ban/blocade)?
No your db execution happens bf you return the completablefuture
Which is blocking
the future returns outside of the callback
it shouldn't block, i don't think?
i think the .thenAccept is blocking, though I'm unsure
is the database.executeQuery() method async?
yes
ah ok, then its fine
.thenAccept shouldnt block afaik, but you could try .whenComplete
whats the difference?
it cant be sync cuz u dont know when you will get the db response
it can take seconds if you have a shit load of data
Hi i have a problem with a module of an custom made anticheat The flight module https://github.com/founder05/GuardianAnticheat/blob/master/src/main/java/me/marc_val_96/guardian/check/movement/FlightCheck.java
thats not an argument for a method to be sync/async, depends on the implementation
Is it possible to do this, but removing the Object 0 instead of the object on index 0?
https://gyazo.com/64ebf4b2a1202c5dfae708c2c812e196
its a reason for it to be implemented async if it takes a long time though
Do I cast the 0 to Object perhaps?
@floral isle what specifically is your problem
yeah i meant that. sry tired and shit eng
.remove((Integer) 0)
Ah, thanks
@crimson cairn the anticheat notify the player when he dony do anithing
@dusty topaz idk the real difference, but it seems to me they make no diff other that whenComplete returns also a throwable if it fails, - I dont think thenAccept has a blocking functionality
what makes you sure it blocks? is it noticeable in timings?
@floral isle that's still pretty vague. can you elaborate how/when this happens?
was just thinking how will .thenAccept be called
anyone tried using https://mariadb.com/kb/en/about-mariadb-connector-j/ or any other connector?
i keep getting exception java.lang.NoClassDefFoundError: org/mariadb/jdbc/MariaDbPoolDataSource, but i added the .jar to the classpath
and imported into class
is is because of the creating normal java threads(ban/blocade)?
@abstract panther bump. help pls xD
i tried everything
@dusty topaz they will store the function, call it when its done lol
its a Consumer youre passing through
@floral isle Oh well that explains it. The check is designed terribly. No offense to whoever wrote your anticheat.
they just store it, and do .accept(<return value>) when the competablefuture is done
get someone else to write your anticheat lol
yeah, but if the .thenAccept is called on the main thread it may be blocking
since it has to wait
the anticheat sends the warnings of the fly to a player who makes a pillar or hops continuously
yeah
the check is garbage juice
get someone else to write an anticheat for you lol
Yeah this Is a snapshot
it doesnt have to wait lol, the only waiting that happens is the writing of the reference variable to the inner Consumer in completablefuture
Some in development longer than you've played Minecraft
@crimson cairn have an idea ti fix it
Ok but i dont know Better method for this
i mean, whoever wrote this clearly has no idea how the client works
There are example of Flight module?
nocheatplus
if you wrote this, I highly suggest looking into MCP and reverse-engineer how motion works in the game
for starters, the basic function for determining the next delta Y is:
((last delta Y) - 0.08) * 0.98
THX the anticheat have problem only with the Flight
and then there are quirks in the game
if abs(delta Y) is less than 0.005, it is clamped to 0
Ok i must go THX for the he help
below minecraft 1.9 (i believe) the client holds back on motion updates until the client has moved at least 0.03 blocks or if 20 client ticks have passed
alright, you're welcome
?services if you want to hire somebody
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/
If you want contributors to Bukkit, I'm sure there are a number lurking about. Myself included
me? xD
oh i meant ppl that made spigot
i am a c# dev 5+ years but new to spigot and kinda intermediate to java ide's
i am sending a mail to support
need a experinced java dev
anyone tried using https://mariadb.com/kb/en/about-mariadb-connector-j/ or any other connector?
i keep getting exception java.lang.NoClassDefFoundError: org/mariadb/jdbc/MariaDbPoolDataSource, but i added the .jar to the classpath
and imported into class
is is because of the creating normal java threads(ban/blocade)?
@abstract panther @subtle blade did you ever try using a sql connector framework?
you would need to shade that connector into your project
i did
The other option is to use mysql's connector which is already shaded in
i am using it but the connection breaks if there are no calles made in the respone timeout perion and i can not reconnect via code
i solved it by making "blank" requests but that aint a sloution
i dont have that kind of dc's in c#
xd
that is where connection pooling comes in
Something like BoneCP or HikariCP solves that problem and keeps connections alive for you
or you can implement connection pooling yourself
thank you
but according to that link you specified it appears that having both mysql connector and mariadb connector on the same classpath can cause issues
spigot automatically shades in mysql connector into the server jar
mysql connector does work for mariadb btw
yeah but it didnt keep the connection. Ill try multiple options cuz its ez to replace
and in examples they use the framework just to get the connection and the rest is java.sql
am i right?
yes, however they do discuss the issue with mysql and mariadb drivers being present
and how to resolve it
as for your driver not being found, I am not sure if you are actually shading it in or not or what build system you are using or if you are specifying the correct driver name. I recommend using maven as it is more reliable when it comes to shading in dependencies but up to you.
i have been lazy to learn maven cuz adding jar is the same as adding .dll in c#
frome the answers i got from another forum i added in the java build path in the order and export tab in eclipse ide
frome the answers i got from another forum i added in the java build path in the order and export tab in eclipse ide
@abstract panther for shading
probably should check that if it indeed placed that jar in your jar like you expected it to
will i can chech with jar size
but just because it is in your jar, doesn't mean it was also added to the classpath either
merely placing a jar inside another jar doesn't mean its on the classpath automatically
anyways, I don't mess with ant build system so I am not all that familiar in setting it up properly. I mostly use maven because it tends to be more reliable and easier to do these things.
if adding to classpath is the same as referencing with maven i did use that
i use several other plugins in my plugin
and it works fine
i know only ant build
from college days
well all I can tell you is that for whatever reason it is not finding the driver. There is only few ways this happens, and that is either you have the incorrect driver name or the driver is not on the classpath.
Google is always a start
3 before me. Think, google it, then if you really cant solve it then ask specific developers.
3 before me. Think, google it, then if you really cant solve it then ask specific developers.
@cloud crater did all of that
sometimes googling fails because of not using the proper keywords and coming here can sometimes give some insight into that 😛
Yep
yeah found out that also got better at java googling
some the same stuff dont have the same name in java and c#
just tack java to end of the google search, most times that works in finding things related to java XD
finally
yeah ik that XD
can some1 help me?
?ask
If you have a question, please just ask it. Don't look for staff or topic experts. Don't ask to ask or ask if people are awake or available. Just ask the question to the channel straight out, and wait patiently for a reply.
i downloaded Itemshop but how do i use it with boss shop pro?
Asked the developer of it?
you can generally see the developers names for resources
and generally clicking on their name takes you to their profile page
where you can send them a message
he does not have discord
that is fine, private messaging on the forums exists
no one can help me fast right now?
@keen compass also shame we cant use normal threads in plugins
People using my plugins contact me using private message on spigotmc or I link my discord 9/10 on my resource page
@abstract panther you can
not sure where you get the idea that you are not allowed to
there is Async tasks too
but you also don't have to use the Scheduler either, you can implement threads yourself
but you also don't have to use the Scheduler either, you can implement threads yourself
@keen compass i tried like 3 different ways and they didnt work xD
then you didn't do it properly. But threads are allowed
then you didn't do it properly. But threads are allowed
@keen compass i made a thread but thread.sleep didnt work
forgot to say xd
depends on how you called it
and how you are referencing the thread you want to sleep as well
Thread.sleep(miliseconds)
cant remember the exact code
its been 2-3 weeks i thinks
think
in C# it references the thread the code is in
Thread newThread = new Thread {
@Override
public void run(code goes here){}
}();
newThread.start();
newThread.sleep(time);
}
very basic way to run a new thread. You can even have a class that implements Thread and put your code in the run method there as well.
Thread newThread = new Thread {
@Override
public void run(
newThread.sleep(time);
){}
}();
newThread.start();
}
i needed this
There is many ways to do it. And no singular way is the best way either as it is all dependent on your code
need to read more java docs so many things are diffrent
but, spigot API also helps with this too. There is methods in the API to schedule async tasks and the server will take care of the thread stuff for you
just like your sync repeating task you found in the api, there is an async repeating task
if that is what you want
i found that few weeks ago
Well just informing you, threads are allowed and are actually encouraged to use if the code will benefit from it 😉
this sql problem is the first one in 2 months that i cant solve 😄
tnx
i am also using something like clean arhitecture so i can replace any part of the plugin very easy
ah, modularizing it?
yes
sounds like a good idea if its complex 😉
yeah making a custom bossarena/dungeon plugin
Hey y'all I need help, When I use luckperms then I start my server to generate the files it just don't work it didn't do anything my server is 1.8 I my other plugins are ViaVersion I tried to uninstall ViaVersion to see if it change anything it didn't LuckPerms don't create any folder can someone help me?
Edit : It do that with all plugins
Are you using the correct versions for 1.8
also take note that 1.8 is severely outdated
and that support for it is going to be very limited as well
if you can't solve problems on your own for 1.8 might want to think about upgrading then
Yes but when I used the latest built via version said like no built for 1.15.2
something like that
I might use 1.12 then
is there a way I can like not use all my world
export the parts you need via world edit?
Syxteen().setDied(true);
what
Don’t mind me sorry
lol
Why is the method setDied(boolean)
cause I cant put any plugins
Can you revive yourself? O.o
cpr?
Got disabled in my update version xD
Should be void.
@bronze marten its bool xD
Smh
@keen compass ill invite you to the server when we open it 😄
Planning to add a lot custom stuff
Hello everybody, I'm getting this error when i try to join the server after trying to create a firework via command block, anyone knows how to solve it?
Console:
[19:45:18 ERROR]: java.lang.IllegalStateException: Cannot make
FireworkEffect without any color
Well there is your problem
need to add a color to the firework
https://www.digminecraft.com/generators/give_fireworks_rocket.php
@deft pollen
use that website to help generate the appropriate commands
I know my dear, but right now i can't access the mc server with my main account because i get this error, and i need to solve that first.
well, with the server off, go into the server.properties and disable command blocks
should allow you to get it up and running to go remove that command block that is causing the issue or disable it
I already turned it off, the error is being caused because the item is in my inventory i guess, i already tried to delete the .dat player data of my account but i'm getting the same error
you sure you deleted the right one? they are named after your UUID
unless it was the only one
deleting the player data file should cause you to be reset as far as where you were at and items in your inventory unless you have something that is giving you the item upon joining the server like a kit or something
Yes, i checked my uuid in namemc, and deleted it;
Hello everybody, I'm getting this error when i try to join the server after trying to create a firework via command block, anyone knows how to solve it?
Solved, I just deleted all "playerdata" folders from all worlds.
well now you can go fix your stuff
This is more mathematics help
how much is 1.5899E12
1.58 trillion?
if so i've done something very wrong
E12 means there is 12 more digits
CPU's will only go so far out in floating points
Im thinking of e+12 then, but still rounding it says its above 10ms..
IE precision as it is called
you need to put a limit on how many digits your floating points contain
and then do your rounding
If you don't do that, your rounding can be off by a whole number as well
due to that sometimes a 1 will generally be at the end of a very long floating point lol
it could be all 0's but there will most times still be a 1
but that is the rounded number to 3 decimal places along with whatever value it actually is, is above 10 so ¯\_(ツ)_/¯
Do someone know deluxehub?
like group aren't working
it show %vault_rank% and yes I did installed vault.
@frigid ember did you install placeholder api?
Yes
where do I type that?
in game
yep
what group are you part of?
hmmm it should do it automatically
ill send you the screenshot
Can someone help me to set up luckperm to show rank instead of default in deluxehub??
It stuck to default
how do I make it so that there are announcements set off every couple minutes?
is this built into essentials or do I need a plugin for this
On the chat is says []CoBra5332 how do I take the [] away?
what's the bungeecord build for 1.8?
Lastest one can work for 1.8 and higher
(float) getConfig().getDouble("key");
ah ok thanks
anyone know any non-deprecated alternative to PlayerPickupItemEvent ?
it still works fine but any alternatives
Can someone help me to set up luckperm to show rank instead of default in deluxehub??
It stuck to default
@cloud crater EntityPickupItemEvent
go ask in luckperms discord lol
thanks @velvet halo
Can someone help me to set up luckperm to show rank instead of default in deluxehub??
what is javadocs
^
why does it pops up everytime I start my server?
loading the jar
lol so I have to wait 20 sec every time I start my server
In the build tools wiki, there is a script for windows that allows you to input what version you want when you run it. Is there one for Linux?
What do you mean? You just java -jar BuildTools.jar --rev 1.xx.y
@echo off
IF NOT EXIST BuildTools (
mkdir BuildTools
)
cd BuildTools
curl -z BuildTools.jar -o BuildTools.jar https://hub.spigotmc.org/jenkins/job/BuildTools/lastSuccessfulBuild/artifact/target/BuildTools.jar
set /p Input=Enter the version: || set Input=latest
java -jar BuildTools.jar --rev %Input%
pause
Is there one of these for Linux?
important help request
I am a nigerian prince locked in conflict and I am looking to move a very important package
also unrelated, does anyone know the unicode character for half a heart
so it renders the same way it does in-game
or is there no unicode for that
@proud lynx that's because the spigot is outdated, whenever a new spigot 1.15 is out, it'll be outdated unless you constantly are updating through build tools.
@cloud sparrow you can disable the message on the start tho
yeah, just saying you still have to wait 20 seconds, unless you constantly update tho.
I just have my system's console check if there's a update and if so it'll automatically compile and restart the server once it's done and installed.
@proud lynx either update or just type:
-DIReallyKnowWhatIAmDoingISwear
in the startup parameter
ok
?
Thats not related to your question @finite belfry
ok
https://gyazo.com/626cfdcabd297591be98b5ceabb8abcc
I can't start the spigot.jar can someone help me please
Sir, the explanation is right there.
Didn't understand u mate 🙂
well @heavy epoch seriously explaination: check if your jar file name is same of the cmd?
@proud lynx it would say that its not accessible
it says its corrupted to just download updated spigot from buildtools and try again @heavy epoch
and look at the parameter in the .bat file
Anyone here familiar with NMS NPCs?
public String loadString(String config_value) {
getConfig().getStringList("HelpMessage");
return ChatColor.translateAlternateColorCodes('&', getConfig().getString(config_value));
}``` how could I get the return to check every line in the string list rather than just one
either return the string list or just use string concatenation
public List<String> getList() {
return getConfig().getStringList("help_message");
}
return the string list then iterate over it to send the message @hallow surge
if its a message
its a message
temedy so something like this could workjava return getConfig().getStringList("HelpMessage")
public List<String> getMessgaeList(String path){
return getConfig().getStringList(path);
}
List<String> message = getMessageList("path");
for (String line : message){
p.sendMessage(color(line))
}
^^ @hallow surge
public String getStrings() {
for(String string : getConfig().getStringList("help_message")) {
String message = String.join("\n", string);
}
}
@hallow surge
§ works in configs correct
no
okay
If anyone here is familiar with NMS NPCs please dm me 😃
that would return formatted message as in the string list
my method
list:
- message1
- message2
and the method should return
message1
message2
i mean it doesnt matter if u loop through all strings in the string list or get them in 1 string
what would i put in my other class something like
String hlpmsg = plugin.getStrings("help_message");
p.sendMessage(hlpmsg);
}```
its returning a string list isnt it?
no
if its returning a string list then it should be List<String> helpmsg = plugin.getStrings("help_message");
lol
if its returning a string then you need to do it like temedy put and yeah that works
than why are you argueing with it xD
not being ignorant, just didn't notice what you said while i was typing chill out lmfao
jeesus people have such low patience these days
temedy much easier than an alternative of a string list
i tried adding /n in my command class
shoulda thought to try adding in main class
what is plugin in ur other class
wdym
Dependency injection
you know about the this keyword existence?
i know this exists
you dont need to name it differently in the constructor lol
then why dont you use it
thx for your help 🙂 this is the part where i leave because you start shaming
what
private final Main instance;
public HelpCommand(Main instance) {
this.instance = instance;
}
replace with this
because it looks better than naming the variables in the constructor different than in the declaration
@brisk mango Main is a terrible name for a plugin.
then name it whatever the class name is
It's not, calling it Main is fine
It's not
give me a reason why its not
The class name should reflect its responsibilities
you should be more descriptive
it can just be called Main, there is no reason why should it be wrong
Main is just main class
It's not tho
Caused by: java.lang.NullPointerException
at org.bukkit.ChatColor.translateAlternateColorCodes(ChatColor.java:206) ~[spigot.jar:git-Spigot-1.7.9-R0.2-208-ge0f2e95]
at me.l3ilkojr.hubcore.Utils.StringUtil.format(StringUtil.java:19) ~[?:?]
at me.l3ilkojr.hubcore.Servers.ServerInventory.getServerGUI(ServerInventory.java:21) ~[?:?]
at me.l3ilkojr.hubcore.Listeners.ItemClickListener.onInteract(ItemClickListener.java:21) ~[?:?]
``` what could be possibly be null?
It's an extension of JavaPlugin.
ItemClickListener:java:21
@frigid ember no idea -we'd need to see the code
Bruh it doesnt matter how'd you call it. its matter of preference
That leads to getServerGUI
line 21 event.getPlayer().openInventory(serverInventory.getServerGUI());
@hallow surge you dont need to be more descriptive in the case of bukkit plugins's main class
@frigid ember The string you pass to ChatColor#translateAlternativeColorCodes is null
You don't need to, but you should.
no you shouldnt, there is no reason for it as i said
and that thing you said cant even be called a reason
if (item.getItemMeta().getDisplayName().equalsIgnoreCase(("&9&l» &5&lServer Selector &9&l«"))) { could i do this without problems or should i use translateAlernateColorCodes?
Imagine someone trying to support 10 of your plugins, all of which have the Main class as the one that extends JavaPlugin - they can't import the class because there's 10 of them. It'll become a horrible mess.
it only errors on the item its looking for tbh
@brisk mango Do you also name your other classes Class1 and Class2?
no
Why would you think your JavaPlugin extension is different? It's not.
public class ItemClickListener implements Listener {
@EventHandler
public void onInteract(PlayerInteractEvent event) {
Player player = event.getPlayer();
ItemStack item = event.getPlayer().getItemInHand();
if (item.getItemMeta() != null) {
if (item.getItemMeta().getDisplayName().equalsIgnoreCase(StringUtil.format("&9&l» &5&lServer Selector &9&l«"))) {
if (event.getAction() == Action.RIGHT_CLICK_AIR || event.getAction() == Action.RIGHT_CLICK_BLOCK) {
ServerInventory serverInventory = new ServerInventory();
event.getPlayer().openInventory(serverInventory.getServerGUI());
}
}
}
}
}
https://discordapp.com/channels/690411863766466590/690470011382267904/712521866035593317
should i still return
return ChatColor.translateAlternateColorCodes('&', getConfig().getString("help_message"));
``` sorry for being ignorant
It's a class that the server uses, just like any other.
Main is different than Class1, i dont want to argue with you about this lol, stop trying to act smart because you arent
You never checked if the ItemStack is null
if you click outside the inventory its gonna be null
ah wait
this isnt inventory click event
ignore me
The stack itself cannot be null, really - it can have type of AIR, though
Chill dude, I was scrolled up at his code.
You should check if it has a display name too
because it doesnt neccessarily need to have one
And calling a random class Main is the same as calling it Class1
What does StringUtil.format do