#help-archived
1 messages · Page 105 of 1
well I'm in same position, just homehosting means you won't have professional equipment to hold against any problems
Which problems?
DDOS attacks?
anything else?
technical ones, maybe less stable internet
than one in a datacenter
What's a really cheap or free hosting
I use humbleservers for minecraft servers
and 3.5eur mo 2gb ram one from ovh for proxy, fallback and databases
I use 2gb one with openj9, so it uses much less memory
You're from europe too?
yu0
yup
Me too
Ayy
one weird thing, there's regular database connection issues between ovh and humbleservers
I haven't contacted support about it yet
but I'll do soon
Why do I need that?
just told that so if you're choosing em and get same problem, I won't have false adviced
Why do you need a database?
it's cool
moving data between servers, displaying it in any server
making leaderboards out of stuff
I don't need that
oh
Between bungeecord?
okok
So Do I get a bungeecord proxy and a few more servers if I buy a more expensive package or?
up to you
but it can turn out to be cheaper to buy many little servers from varying providers than one big
homehosting may also just work, you have to take decision carefully
Hey, is there a way to obtain this from the server version? It's to achieve multi compatibility.
What's the best server hosting?
there's no best, it's really competitive
The most known that have great hosting
lag free or something
are you using viaversion? @bright forge
oh
or its not specified on spigot?
Idk mb nms
well thats an easy answer, i had been searching the source code over and over and i still have no clue :/
Can you explain more by multi compatibility. Maybe the protocol ver isn’t necessary
i have to make some kind of comparison to know something like...
if (version > 1.12) {
return a;
} else {
return b;
}
hi - do minecraft servers get my public or local ip address? and how do i change it?
Linsa a plugin?
yeah
maybe i can just take the first and second value and use that as a integer so it would be...
if (version > 112)...
i use reflection
the thing is
https://github.com/Sxtanna/VersionedGradle I'd suggest you have a look at this
in 1.12 is .a() but in 1.13 is b()
so it wont work unless i manually check versions
its not sorry
the nms source changed what method is used
so its impossible to achieve compatibility unless you manually check versions
@wind dock they get your IP address yup
which 1?
anything you connect to gets it
Achieving your plugin having compatibility by nms version is very possible
public, what else
which ip address
dude you dont understand
public or local
god
Idk why you need protocol versions
to use > and <
http://github.com/purplexdev/packetevents 1.7.10-1.15.2
But if i do /whois GeometryPro in my server, it shows my local ip address
just in 1.13 a method name changed so i cant use it in 1.13 unless i manually check
@wind dock because it's your server
?
oh
multi version support packet listening
How do I change my public ip?
wrapper classes
so i wanted to know if there was a way to get protocol and use >< for comparison
If it’s 1.13+ just get the Bukkit version and compare?
contacting your internet provider / using VPN / some routers have ip changing capability by restarting them@wind dock
if (version> 112) {
id = (int) packetDataClass.getDeclaredMethod("g").invoke(packetDataSerializer);
} else {
id = (int) packetDataClass.getDeclaredMethod("e").invoke(packetDataSerializer);
}
ipconfig /renew?
The protocol version does not dictate the remapping of methods
You should not make decisions based on an ever-changing value
copy that
what should i do then
serverversion
@frigid ember in my essentials userdata folder, it also shows my ip address as my local ip, not public
it doesn't make a difference
it's your server
im telling u linsa uh bye
so it won't get Publix one
oh
@frigid ember absolutelly nothing to do with my issue thanks anyways
k
If there is API you require not already present in Bukkit, create a pull request
If it's something such as packet listening, use ProtocolLib
im replacing protocollib
Wth
You're not going to succeed in replacing PL
It's practically standard
The best anti exploit is 1.15.2
k
Keep your software up to date
yeah and the best performance killer
oof hehe
you cant even run the official spigot server with 0 players at 10 tps
Lol pretty sure you can
(not trying to be rude)
Maybe if you're doing something stupid, though I run all my test plugins just fine without any issues
bad pc then
I believe you though the best way to diagnose that is to use the in-built timings
official server from spigotmc
you said 0 players 10tps
That’s weird because my server has 19.5-20 tps all the time
im speaking about
There is a cause for performance issues of which can be remedied
if you type /tps it's 1 player
Though I can assure you that running outdated software and writing an "anti exploit" is far from beneficial in any way whatsoever
im not talking about a server i own
If you mean #spigotcraft, it's a test server running on a bleeding-edge snapshot version
btw theres a bunch of exploits that still work on 1.15, just no one tries to use them there because they are the least played versions
LMAO
choco ik best anticheats but they are for 1.8
alright
1.7-1.8 outdated versions
If you think that, it's really not my problem, Linsa. You're on your own
I advise heavily against what you're doing
but hey, power to you
i've never asked for help for that
i already asked for help trying to get 1.15 without lag but i never got a clear answer
so i had to switch back to 1.8
use paperspigot 1.8.8
haha yeah
The exploit opportunities of that thing are infinite
Oh i was speaking about the fact that you can create items that weight +300k bytes
oo
they used them to crash 2b2t
or use 1.8.8 paperspigot
@frigid ember Im trying to develop a public plugin, im not having issues.
@subtle blade why was PlayerLoginEvent renamed in some versions
I was just asking for help to get a way to compare versions with ><
what were yall thinking
or removed
idek
why bruh
hytale is almost out guys and theyll focus more on combat, just a bit more longer to wait
it will be actually good
just idk why java tho, they should just do c#
for modding
Anyways i love discussing about new versions changes, and i will always defend the fact that since 1.13 the thing is not stable if you want to run +20 players, even if you disable village/stronghold/etc generation and make a only plains biome world it will lag like hell because of all the new mechanics that keep entities and chunks alive.
Since 1.9 they started adding stuff that keep chunks loaded and entities loaded too which made it impossible to host a survival server after months of world use.
I don't add people sorry
Anyways thx for the help ill probably do a thing that converts the server version to a int and compare it
something like
1_7_10 -> 17
1_15 -> 115
haha, its for programming a plugin not for linux system thing
oh
lets see
nice but what about 1.16 release? i have to update manually
i dont wish that
i want it to work automatically
nice implementation tho :)
but what if 1.16 releases?
i just dont want to make updates manually
for protocolversion u must do same
because i will get reviews of it not working
bruh
or people have to wait me
u can be fast
does every api release fast
nop
for now announce it supports 1.7.10-1.15.2
people that hates me uses that as an excuse to give negative reviews even if i update fast
or whatever versions it does
i just want to relief myself
no
thanks anyways
there is no automatic way
yes there is lol
1_16_1 -> split -> get 0 and 1 from the array of strings -> convert to integer -> 116
it works fire rushes into my house
u are sayi ng ull get bad reviews
atleast it will work for the next years
cos u update slow or what
my plugin has like 60k downloads
protocollib doesnt even support 1.7.10
server.getVersion()
its not the same
thats because 1.7.10 doesn't have netty in the server files
what a mess
i made a new injector for 1.7
i hope someone forks 1.7.10 and fixes that thing
to supportnit
nice
anyways have to go, thanks
bye
Hello, how can I get two corners from worldEdit api when pasted a schematic thanks
Can I develop plugins on the latest version of JDK?
if by that you mean java 14
yes
yes you can develop
but you're gonna be you and a few others who actually have jdk installed
I thought you need to have JDK in order to develop plugins
Please help, I have hicoria hosting.
I have BungeeCord server and...
Spigot servers.
I need startup script on BedWars and UHCRun. After game server is will stop.
Need wait to 0:00. Hicoria in this time restart the server. I need after game startup script.
Uhcrun version: Spigot 1.8.
Bedwars version: spigot 1.10
Sorry for my English, I'm from czechia.
Please help.
@frigid ember yes but not everyone remotely uses 14 yet may be a while before that even happens
/summon Item ~ ~ ~ {PickupDelay:32767,Age:-32768,Item:{id:diamond_pickaxe,Count:1}} how do i make this command global?
Can you help me with startup script?
I have hosting I Don not know how to create startup script
https://gist.github.com/frostalf
@soft tusk
What JDK is most used? 1.8?
Afaik ye
Why’s that ?
the jre
Compatibility
yo can y'all help me
With that
basically i need someone to delete/remove some files in a plugin's source code
the developer added a unnecessarily feature i would like to bre removed
does that work?
But use the hire section on spigot i guess
yeah i already found the classes
in the java decompiler
i just want 2 delete them
but i dont have eclipse installed
Mh no dont xd
?
Dont just straight delete them
Deleting a class will break other class calls
So ud need to delete all references to them
Unless its a factory class like v1_15_1 its usually called upon via another class i.e imports and methods
could you help me with it then?
Not at pc
oh
But seeing as its a fly command its called within the commandmanager class probably
So ull need to open and alter it anyway
yeah its messing up a lot of my plugins
Anyone know how I can change the item moved in an inventory on a shift click? I want to replace an item with another when someone takes it out of a chest but it doesn't work on shift clicks
Using event.setCurrentItem() doesn't work
I know I can detect when they shift click, my problem is that I don't know how to change the item stack that gets moved
An inefficient solution i can think of rn is like keep a map of what itemstack is where during the event, then a runnable a tick later or sth to check new stacks
But InventoryClickEvent#setCurrentItem doesnt work you say?
Seems odd, might be a bug?
wait yo @bronze marten
if you remove a command in the commands section from plugins.yml, does that command not work anymore in the plugin?
It would error in the plugin if they try to get the command
fly:
description: Allows you to fly!
aliases: [flight, togglefly, toggleflight]
If they dont check if it properly is in the plugin.yml
Would it be able to work with another plugin then?
Since this plugin's /fly command is conflicting with EssentialsX's /fly
so I want to disable this plugin's /fly command or something
You could use commands.yml to override /fly with essentials fly
Just rewrite /fly to /efly i think
Or /essentials:fly
could you show me an example config?
I think this should work
aliases:
fly:
- "essentials:fly $1-"
so this overrides this plugin's /fly with essentialsx /fly?
should be yeah
okay there's a option in the plugin's settings that disables /fly, but when I do /fly on essentials, it disables that one also, will this override it?
Or couldnt you replace the fly command in the commandMap with your own
This will not forward the command to that plugin anymore
Like it wont receive the command
It will always rewrite /fly -> /essentials:fly
oh okay
gotchu
appreciate it man, everything works, disabled the fly command in the plugin, and /fly still works now
👍
Is there a way to make a void generator?
Set current stack works when the user normally clicks on it, but when they shift click there never is a current item
Does anyone here have knowledge within Redis / Java Redis I'm trying some things out but I'm having difficulty understanding some things.
Willing to pay ^
Hey guys, is there a way I can get the ID of a BukkitTask, in the implementing Runnable class in an async scenario? For example:
In main...
BukkitTask exampleAsyncTask;
@Override
public void onEnable() {
this.exampleAsyncTask = Bukkit.getServer.getScheduler().runTaskAsynchronously(this, new ExampleAsyncTaskRunnable);
}
Runnable class:
public class ExampleAsyncTaskRunnable implements Runnable {
@Override
public void run() {
// How can I get the taskID of the BukkitTask running this runnable?
}
}
What do you need the taskid for?
It's a little complicated, but this is for a plugin that connects to a Google Cloud, not for SQL but for Pub/Sub functionality. I need the task ID as the Google Cloud code has its own async stuff that isn't shutting down properly, so I need the task ID in the runnable.
If you want to cancel the task from inside, i suggest using BukkitRunnable
It also has a #getTaskId method
Ah, fantastic! Exactly what I need. Thanks 🙂
@bronze marten I've read around that Runnable's are generally "preferred" over BukkitRunnables. Is there a particular reason as to why this might be? Is it simply because one implements and the other extends?
I dont see any reason to prefer one over another, it might be an unneccessary wrap if you dont need the methods provided
but for this case its perfect
Fair enough, thanks. 🙂
Yooh, who remember that slime split error that I was having
vaguely
Am i doing something wrong here? I want to see what enchants an item has but when i use Item.getEnchantments or Item.getItemMeta.getEnchants its either null or empty, but i know the item has an enchant and that im checking the correct item
If its null/empty you aren't checking the right item some how.
Usually you have to do item.hasItemMeta() and then get the item meta and check that.
figured it out, getEnchants doesnt work on enchanted books
well... yeah. Would have been more helpful if you said the item then lol
Hey guys, is this the proper way to check if a string is an integer?
int i;
try {
i = Integer.parseInt(args[0]);
}
catch(NumberFormatException e) {
return;
}
It will work, wouldn't really say "proper" tho, you can just use regex to check if its a number.
"123456".matches("\\d+");
yeah, if you are ignoring the error, you name it ignored.
But regex in this case would be faster since its a simple check. And is much more readable than a try/catch block
Well, you can still parse it over later, but in this case, its just in a block, and the result is being ignored
Anyway, regex is surprisingly fast. I had it run over player chat on huge servers to scan for IPs, links, etc.
You can also use NumberUtils.isNumber
then you have to shade in commons (i think it's commons?)
Yeah, that's commons
it's an internal dependency
not supposed to use without shading
(it's also out of date)
Its an internal dep, you have to either shade it in or include it as a dep for your project.
ah
Yeah
Yes, which is depended on internally
You can shade a newer version if you'd like but if you're working with NumberUtils, it's unnecessary because 2.6 shares the same class and utilities
Anyway, have a look at these regex patterns I used: https://owo.oooooooooooooo.ooo/i/64vj.png
Guava is also shaded into bukkit
Why it is eww?
Its not modular. So unless you are utilizing a shit ton of it, its just bloat.
Its also google, and google APIs and libraries are horrendous.
Bad documentation, says one thing, does the other, never consistent, etc
bold statements
Guava's non-modularity does kind of blow when writing standalone applications
Isn't google search engine based around guava cache?
Its utilities are quite nice for plugin development however
Bold statements backed up by so many years of working with their stuff
Main thing I use is ImmutableMap lol
Almost 4 years working with their oauth, calendar, and other related APIs and I can safely say google's apis and libraries are the worst things ever.
So much bloat too
I use it for cache but I am looking at ehcache then again could just use redis
You don't need an immutable map from guava tho, google.common has one that's even lighter. and its a smaller overall dependency. Google loves to repeat their code
I use unmodifiable instead of immutable
but i only really code spigot stuff, and bukkit kindly has guava
I am not a fan of bloated libraries also tbh.
Yeah I use that
I like the builder :p
and unmodifiable map I believe isn't a copy
so it's not reaaaally unmodifiable
Also, with some clever writing, you can just make an immutable map without guava anyway.
Base java allows it
nah the builder is what's nice
because I mainly use it for storing values for something
something like
private final static ImmutableBiMap<Integer, ChatColor> COLOR_MAP = ImmutableBiMap.<Integer, ChatColor>builder()
.put(0, ChatColor.BLACK)
.put(1, ChatColor.DARK_BLUE)
.put(2, ChatColor.DARK_GREEN)
.put(3, ChatColor.DARK_AQUA)
.put(4, ChatColor.DARK_RED)
.put(5, ChatColor.DARK_PURPLE)
.put(6, ChatColor.GOLD)
.put(7, ChatColor.GRAY)
.put(8, ChatColor.DARK_GRAY)
.put(9, ChatColor.BLUE)
.put(10, ChatColor.GREEN)
.put(11, ChatColor.AQUA)
.put(12, ChatColor.RED)
.put(13, ChatColor.LIGHT_PURPLE)
.put(14, ChatColor.YELLOW)
.put(15, ChatColor.WHITE)
.build();
simplicity in the short run, bloat in the long run. That's what JS is for.
That's what ENUMs are for lol
literally what you just did there is a worse performing enum
legit
@subtle blade so would this be the best way of doing it?
int i = NumberUtils.stringToInt(args[0], -1);
if (i < 0) {
msg(p, Lang.MUST_BE_NUMBER);
return;
}
it's an example class for an api i made lol ¯_(ツ)_/¯
Its such bad practice, and that will perform horribly compared to an enum
That's how I'd do it, Phaze, yea
Also @worn temple I had to make the spell cloneable when using it as a parameter for the enum as it wasn't creating a new instance in the map everytime. It was kinda weird (This is yesterdays issue btw)
Though there should be just a toInt() function, no?
@velvet halo ah
Works pretty well now
neat
are all those conditionals really faster than a #get?
The switch conditionals? That's just for handling user inputs so no try/catch block is needed. But yes, it is faster then a #get on a map
I'd have just used an array lol
You could also iterate over the enum values and check for it?
Access index at value - 1, boom. Check for outlier values
Its year old code, so could be improved, but overall an enum is better than a map if your values aren't changing like that immutablemap example you showed me
yeah definnitely
i wasn't thinking about it too much, i wrote it at 4am last night (morning?) as a quick example for an api i made as a proof of concept for a friend lol
ImmutableMaps have their place and use, they are useful for sure, just the example you showed was bad.
scratch that, was 5 am :p
Weird because when I program at 5am my brain switches on
at midday it just poops itself
i do best from like 1am-3am
It depends heavily on when I woke up
Anyway, if you want examples of my good code: https://github.com/DreamExposure/DisCal-Discord-Bot/tree/website-rewrite
I am going to put my spells plugin on git if anyone is interested. I am not amazing at programming but it should function
FOSS is the way to go
Pro Tip @velvet halo : add .idea/ and *.iml to your gitignore. those are system specific files and don't need/shouldn't be included on the github repo
Otherwise, looking good
just fyi, when you do add that to the .gitignore file
those directories and files will remain until you remove them from the repo
yeah
best to remove them from the github page and then pull the changes into your local repo
but only after you add them to the .gitignore
otherwise you might find those things missing in your local repo if you do it before then XD
So it is safe to remove Spells.iml from my project?
in the repo yes, not sure if your IDE uses it
if your IDE uses it, add it to .gitignore
this way you can keep it, but it never gets pushed to the public repo
But as already said your repo looks good aside from those few things
🙂
I will make one other suggestion and that is creating a README.md and license file that resides in the same place as pom.xml
README.md will get displayed on your repo page just below
and you can use markup stuff in there to make github display it nicely
Wish there was a default gitignore for intelliJ projects
the license file github can read as well usually if its a common license and in the proper format and lets others know what they can do with the stuff in the repo
there is a website for generating that file
just add all the common stuff on that toolbar hit create and it will generate most of it for you
then its just a matter of adding anything that wasn't covered yourself
What license do you normally use?
Is there any method to cancel the death of a player? For example, before dying, change the gamemode
@velvet halo depends on the project, but I mostly use MIT
if I make something public, I really don't care what people do with it
Me neither I mainly want feedback
its not like I have the resources anyways to go after people, so I just keep the mindset of just not caring. If I didn't want people to use it, I wouldn't have made it public 😛
Yeah same lol
but I slap on a MIT license so those who do care about a license, there is one. and MIT is not very restrictive and pretty much states they can use it for whatever they want as long as the license remains intact 😉
also, this allow people who want to use it in a closed source project can as well. Unlike GPL not as easy to do so lol
Anyone know how to fix this in Eclipse?
it says this now
The word 'int' is not correctly spelled
@frigid ember that isn't what it is telling you I don't think
but not sure why you are casting to an int
when you want a string anyways
Alright, I fixed it
@keen compass hes casting the double to an int so he doesn’t get the floating points, just the integer value
So it’ll say health is 5/20 not 5.3822/20
Hi, i have a problem when I get a project from github that my friend shared to me
maven isnt loading and that spigot icon isnt either, nothing seems to work, any idea? :c
yo... i'll pay for help
x))
dont try and dm people for support lol
this is what the channel is for
you probably haven't added the pom to your project
I assume the spigot icon you're talking about is the Intellij Ide plugin
which should just show up if you have a main folder
They are cloning from GitHub over and over rather than using git properly from what I can tell.
And sharing the .iml and .idea/ files on the gh as well.
Hey guys, is it ok if I put these comments on my enums so I know which ones have placeholders?
/**
* Title, %%args%%
*/
TITLE("title-name", "&4[&fAWSMPLUGIN&4]:"), PLAYER_IS_COOL("player-is-cool", "&f%%args%% is cool."),
Hey guys, is it possible to get negative reviews removed from your spigot resources & profile page? (One's that are purely going against you and not the plugin itself) I've got some guy posting random stuff on my profile page which is all false :/
You can delete it yourself on the profile page
Report the review.
And you can delete whatever is on your profile page as phaze said
He said he will just keep posting on my page if I delete it. Not sure if it's true but I imagine he will.
I mean if he keeps doing it then report him
How?
Just report their profile on spigot then. A staff member can help
You see the report button?
I think you can block them too
I think he's ignored me so I can't go on his page? Says he don't exist yet he's posted on my profile.
Yeah, you can just block then.
Will that prevent them from going on my page?
yes
I only see the ignore button.
@barren abyss @warped shuttle Yeah, they aren't using GH correctly at all.
The file structure is wrong: https://owo.oooooooooooooo.ooo/i/80bb.png
There is no pom included, its basically just source files with nothing saying that anything is actually a project.
Yeah, somehow no .iml or .idea/ files included. I don't know how its possible to do it so right but so wrong
what should I include in order to use github to work together with the plugin with a coop
learn maven

or gradle
Yeah, I probably should
absolutely should
yeah, you're not using maven correctly in the slightest from what I saw
anyhow I fixed the error that I've been having but thanks anyways
I delayed learning it and it was a huge mistake
Also, learn proper project file structure conventions
Should be:
projectFolder:
src:
main:
resources:
plugin.yml
java:
you-package-name:
PluginName.class*
package:
YourClass.class
YourOtherClass.class
pom.xml
.gitignore
README.md
- main file, naming it main is just redundant at this point, and is less descriptive. Main.class is less descriptive than PluginName.class. Its just a bad practice introduced to newer devs unfortunately.
@unborn schooner There is a help channel for a reason, please use it: https://owo.oooooooooooooo.ooo/i/6s54.png
Nova, sorry to be a bother. How does one block a user from going on my profile? Ignore simply makes me not see them afaik.
I pressed ignore, and I sent my profile to my friend and he could still see all the messages.
It only hid them from me.
Yes, you don't see them, and they can't post messages on your profile/DM you.
So if I delete them, ignore him, they can no longer see my pfp basically your saying?
Sounds good.
OfflinePlayer pl = Bukkit.getOfflinePlayer(uuid);
StringBuilder st = new StringBuilder();
st.append(pl.getPlayer().getDisplayName());
If I use getPlayer on an offline player, and that player is not online, will this cause an error?
OfflinePlayer#getPlayer() returns null when the player is offline.
Yes, also, you have to check OfflinePlayer#hasPlayedBefore() as OfflinePlayer will always return an object, but not always a real player.
Is there an easy way to make this? example:
The server <ServerIp> is using <MyPlugin>
(Im using linux shell stuff to take the ip and drag it in a variable)
o.O
I made a plugin where it'll announce to the server that the TPS is below a certain number. This is not working, though.
So i'm trying to create a minigame plugin, but i got stuck on arena management, i want it to duplicate/clone the arena when there is a new game session, whats the best way to do this? i tried to copy and load a world but it seems not really a good way to do this
After a lot of try, I've decided get player's latency by packets except KeepAlive is impossible now. I don't know maybe 1.16 and up will have this future but for now not.
Change random tick speed method?
@chrome edge well, keepalive was made to ping client.
You can also try something like assign velocity and see how long it take for the client to move.
But whatever you do, keep in mind that there's always a workaround
I've made L4 ping spoofer before and that's exactly the same as legitimate internet lag lol xD
/summon Item ~ ~ ~ {PickupDelay:32767,Age:-32768,Item:{id:diamond_pickaxe,Count:1}} how do I make this command global? pls help
@obtuse rose You're right. I'd never say impossible word but as I see from my experiences, it cannot be accurate player's latency. So there's no way to get accurate.
As I remember there's a method that returns what you said in NMS Block until 1.13.2. Take a look in the class.
does anyoone know how i set the pickupdelay for everybody
Items are entity in world *not in inventory
Plugin AntiCapsize v1.0 generated an exception while executing task 11
java.lang.IllegalStateException: Asynchronous command dispatch!
Can you not run bukkit asynchronously?
You shouldn't use bukkit api in any of async thread.
Then how would I fix that?
make sync thread in async
how do I do that
//Bukkit API code
});```
I'm sort of new to this. I put that in, right - and now "plugin" is giving me an error.
Just put the sync in if tps statement and inside of the statement to in sync
plugin is your plugin instance
blackbone, sorry but i dont seem to understand. should i use a command block for the command?
hmmm that code make no sense
Dont do that, just do it all in one sync delayed task lol
Its not like that one message will lag your server out / getting the tps
I don't know the command block.
also, "Server is good" will be trigger when server lagging
also TPS is not 20.000000 all the time
sneak 100
it's usually stay at 19.9X
so what should i do
@neat orbit Sorry, I don't know the command for pick up delay...
ok
this is the command /summon Item ~ ~ ~ {PickupDelay:32767,Age:-32768,Item:{id:diamond_pickaxe,Count:1}}
i just wanna make it global
I think you should use plugin for that.
Or make command block system that trigger whenever item is spawned
public void runnable() {
new BukkitRunnable(){
@Override
public void run() {
if(TPSListener.getTPS() < 20) {
Bukkit.broadcastMessage(ChatColor.GREEN + "Server is good");
Bukkit.dispatchCommand(Bukkit.getConsoleSender(), "gamerule randomtickspeed 3");
}
else if(TPSListener.getTPS() < 15) {
Bukkit.broadcastMessage(ChatColor.YELLOW + "Server is lagging just a bit");
getServer().dispatchCommand(getServer().getConsoleSender(), "gamerule randomtickspeed 2");
}
else if(TPSListener.getTPS() < 12) {
Bukkit.broadcastMessage(ChatColor.RED + "Server is lagging a lot.");
getServer().dispatchCommand(getServer().getConsoleSender(), "gamerule randomtickspeed 1");
}
else if(TPSListener.getTPS() < 10) {
Bukkit.broadcastMessage(ChatColor.RED + "Server is almost unresponsive.");
getServer().dispatchCommand(getServer().getConsoleSender(), "gamerule randomtickspeed 0");
}
}
}.runTaskTimer(this, 0, 20);
i added ".runTaskTimer(this, 0, 20);"
alright
that will do nothing when TPS is 20 or over 🤔
you realize TPS does go up to 20.0X sometimes right
It's not super stable
what happens
if the tps is <12 you won't see those messages lol
Just swap your first comparison with >= 19.9
^
wdym
< 20 -> >= 19.9
@bronze marten gotcha
i copied and pasted lol
< 15 as well
@frigid ember try to debug your fields. If there's an error you can easily see with debug.
and try to use it in function not in thread
@bronze marten oh you're right xD
Basically every value lower than 15 will go into the first block
Then how do I fix it?
You're using reflections so it might be empty class or etc.
Why doesn't it work backwards?
or rather, the way I'm doing it
Well think about it, where does tps 14 go? And 12? 10?
Its smaller than 15 right?
So it will go into the < 15 block
No offense, but you should learn Java before making plugin tbh
Do you need to use reflection? Will you use with multi versions? @frigid ember
@obtuse rose People who say "no offense" literally say offensive things for future reference haha
I'm coming from python and it's a little bit of a learning curve but it's not bad. I'm following two tutorials (TheSourceCode and thenewboston)
IChatBaseComponent footerJSON = IChatBaseComponent.ChatSerializer.a("{\"text\": \"" + ChatColor.translateAlternateColorCodes('&', this.bottom) + "\"}");
PacketPlayOutPlayerListHeaderFooter packet = new PacketPlayOutPlayerListHeaderFooter();
try {
Field headerField = packet.getClass().getDeclaredField("a");
headerField.setAccessible(true);
headerField.set(packet, headerJSON);
headerField.setAccessible(!headerField.isAccessible());
Field footerField = packet.getClass().getDeclaredField("b");
footerField.setAccessible(true);
footerField.set(packet, footerJSON);
footerField.setAccessible(!footerField.isAccessible());
} catch (Exception localException) {
}
((CraftPlayer) this.player).getHandle().playerConnection.sendPacket(packet);``` @frigid ember
Try to use like that
I don't think so. What I'm doing now is the same thing I've done in python (obv without minecraft lol)
just try this code... if it works there's no problem with using it
Or maybe I'm just being a dope
But yeah try swapping the blocks haha
Java doesnt have sth nice for
if (<=)
else if (<=)
else if (<=)
Unfortunately 😔
don't leave empty catch block!
I really hate hackers... I've to control their ping for the timing things and they can spoof it.
Mbe ehm, put code in online paste sites if its larger than 5 lines xd
Hard for mobile to read xd
@frigid ember Are you sure it's final code of yours?
I set it to 19.9 and it doesn't print anything anymore lol
Do you use notepad or something lol. There are tab miksates
don't ask me try it and if doesn't work tell me the error
Just use vim

Sounds like a you problem
@obtuse rose It's from my old library lol. It was work so I post here for just help
I hate reflection actually. I just want to loyal on one version at all.
@frigid ember I don't like to judge people but as I see you don't know Java at all...
This is how I have it set up now, but it just constantly runs the task. It is doing what I want, but I don't know how to set the delay on the messages unless one of the if statements happens.
You have only one try statement so use only one catch for the exceptions.
I though you're starter for packets and reflections...
This is not java help platform. So if you don't get any help, it's normal
@frigid ember you want a delay on the messages? Or what do you mean?
Because to me it seems rn that this runnable is run every 3 seconds, delaying messages wont help
@frigid ember So try with basic to understand the bukkit library.
Do not start with reflections lol
and try to learn java basics
You don't have to tell me how to do it, I'd rather just have a direction on where to start so I can try to learn how to use these tasks and schedulers.
I want the TPS check to occur every 3 seconds. The plugin is doing what I want.
However, the messages also do that and that's not what I want (even though I've made it so). Is there a way that to make it so it'll only send the message once unless it passes one of the thresholds I set (<10, <12, <15, and >=15)?
This is great starting for you but not start with reflections please. It may be dangerous for you for now.
Just use bukkit library for now to your safety
Ah, so you want it to only send a message when the TPS is in a different block?
Yes!
after learning some of the basics you may want to use
You could use a variable which holds the last tps
But I don't say stop your self. Go straight for you dreams. I'm saying it's noty good starting for you
And check in each if and else if if that variable is also not in the same tps category
To eliminate code duplication there, you could make a nice method which returns a boolean based on the current tps, the “comparison tps” and the last tps variable
@frigid ember For you, try to use every events from spigot library after that make a game or something. Use here for the more information about API; https://hub.spigotmc.org/javadocs/spigot/overview-summary.html
Hm. Alright. I'll try that out. Thank you.
Maybe I should finish some tutorials before trying that, because I don't know how to do that lol.
If you say it's easy use packets but not with java reflections
You're lacking java basic knowledge
You know some basics of course but not at all
@bronze marten is there a good document that would explain that?
Eh possibly, hard to find a tutorial for a specific case though, its mbe better to learn from the basics
Why is player.getTargetBlock(null, range); deprecated
is it removed in future versions
Use BlockIterator
Any good tutorials you recommend?
why frank
I want something that exists in 1.7.10 ->1.15.2
does getTargetBlock() exist in them
don't ask why
I use BlockIterator in 1.8-1.15.2
1.7.10?
ok
how do i use it
i want to find the block the player is looking at with a range
Just pass the player & the max range? Lol
Then you can construct a for loop over that iterator, check if block is air, continue, else return that not air block
Yes
I have a question, can I move an entity without actually teleporting it?, like... this enderman thing, he don't teleport, he do something like a "dash"... idk if you can see my point
not with teleportation
@bronze marten question
Whats the diff between player.getNearbyEntities(range, range, range); and player.getWorld().getEntities() and looping
does getNearByEntity loop
or does it store in memory for each entity the nearby entities? (which I'm doubting)
to make it faster
@barren abyss You can use velocities to move entities around.
That's what I use for my dash abilities.
@frigid ember AFAIK, they're the same thing
ok
what about world.getLivingEntities() and world.getEntities() loop and add the living ones in aloop.
Does the getLivingEntities() method have an arraylist specifically for the living entities making it faster or not.
Whats the diff between player.getNearbyEntities(range, range, range); and player.getWorld().getEntities() and looping
@frigid ember absolutely no difference, CraftEntity#getNearByEntities() does the same as looping over all entities in the world.
and second question
what q?
oh
no getLivingEntities also loops over all entities, just filtering out the non living ones
"bruh"
why bruh xd
lol
for what i want to do I am forced to use NMS
to find an entity with id
This would be too slow.
lol what
uh
Honestly looping over the entity list isnt that bad? just dont do it very often
And you are accessing entities by ids at a quite fast rate
I am dealing with packets here.
I am forced to use MinecraftServer.getServer().getWorlds().get(worldIndexAsExample).getEntity(ID);
i want to support 1.7->1.15.2 sad thing is getEntity method and getting worlds changes in the versions
1.8->1.8.8 named getEntity to a
Can't you do Server.getEntity(id)
Mh yeah, go for nms much faster
ik but its a lot :c
xd
im tryna use reflection for it to support multiple versions but it gets so confusing
they have a HashMap which stores the entities in a <UUID, Entity> fashion
ik
xd minecraft server class, method for getting instance, then get worlds in some versions its a list field some its a hashmap
then getEntity method which is named a in 1.8 versions
🤦
doing that all in reflection breaks my brain
So I will rewrite it for each version
So I keep my brain cells
¯_(ツ)_/¯
@frigid ember Where do you send the packet? or am I missing something?
Up to you lol, go through the hell of supporting a decade old version or stick to the new ones
It doesn't look like you're sending the packet.
Dude, Retrooper stfu
Retrooper is saying you shouldn't get the Fields within the timer because they're going to be the same every time you run it.
Also, you're never sending the packet to any players.
I've said it
like 3 times now
I told you what you need to do.
Because you explained it and then less than 3 seconds later you ping him and say |
"hello???
???"
Just chill.
oh
my
god
private boolean titlemanager;
@Override
public void onEnable(){
saveDefaultConfig();
new FlyCommand (this);
PacketPlayOutPlayerListHeaderFooter packet = new PacketPlayOutPlayerListHeaderFooter();
Field a = packet.getClass().getDeclaredField("a");
a.setAccessible(true);
Field b = packet.getClass().getDeclaredField("b");
new BukkitRunnable() {
@Override
public void run() {
try {
a.setAccessible(true);
Object header1 = new ChatComponentText("§b§ltixtiggy");
Object header2 = new ChatComponentText("§b§ltixtiggy");
Object footer = new ChatComponentText("§atixtkittűű");
if (titlemanager) {
a.set(packet, header2);
titlemanager = false;
} else {
a.set(packet, header1);
titlemanager = true;
}
b.set(packet, footer);
for(Player p : Bukkit.getOnlinePlayers()) {
// Send packet
}
} catch (NoSuchFieldException | IllegalAccessException e) {
e.printStackTrace();
}
}
}.runTaskTimer(this, 0, 20);
}
}```
oh well the set accessible should be out of the task as well but
there ya go
You're never SENDING THE PACKET
You'll need to catch it and remove the other catch
((CraftPlayer) player).getHandle().playerConnection.networkManager.getVersion();
Is there a more efficient way to set an entire X-Z coordinate to a certain biome than this:
for (int Y = world.getMaxHeight()-1; Y > 0; Y--) biome.setBiome(X, Y, Z, biome);```
Just profiled my plugin and that code takes up a fat 7 milliseconds
@frigid ember Do you use a plugin like ProtocolSupport or ViaVersion etc?
Paper Spigot offers the method. If you don't use paper just check how they do it
Player#getProtocolVersion
Is it how Paper works to do it?
Yep so just check how paper do to fetch the protocol version of the player
?kick @frigid ember
👢 Kicked purplex#8384
If you aren't using viaversion etc you can only have one protocol version and it doesn't matter; if you are then you should use them
This is an
?xy
Asking about your attempted solution rather than your actual problem
im checking player's protocol version, yes im using viaversion xd
Then just depend on it
just i dont want to force users to use viaversion just so i can check it
maybe they have sth custom
alright ill depend on it
But if they don't have viaversion then why does protocol matter
nvm ima just depend on it
Just do a check if ViaVersion is installed on the server (check if the plugin is present as softdepend) and if yes, use the Viaversion API
btw what was ikicked for
for the paper thing i said?
just im ngl lmao
ok fine spigot is best.
Everything depend on what you need and what you want your server behaviour to react
Paper is just Spigot edited (like Spigot edited Bukkit for instance)
So paper is spigot
so i should edit paper so i can improve nothing to the other 3?
But with more features
@frigid ember Yes some more features (which are not essentials)
as it has more features and they are useful too
so i should edit paper so i can improve nothing to the other 3?
@frigid ember Yep
It's not worse
There are pros and cons
name a con
ok
But it comes with faster performance (You need to sacrifice to improve)
just look through the patches
Many behaviour, you could probably learn more by reading their page
I guess if you come from vanilla you may notice the difference in behaviour, but I doubt the regular player will notice it lol
they made stuff easier
these are good patches on spigot
added getTPS method
vers command
handshake event!
added
like cmon
This is something you can make with a plugin
i don't see these as a sacrifice
yes but its easier if its already in your api you are using
Sacrifice is where they improve the performance
imagine for each plugin you had to readd it
getTps doesn't iprove performance
its not only performance, also extra good api
api patches
you really like hanging on to things .-.
pebblehost, paper
mojang 
i see it's a nice help channel 😄
Looking for a plugin that deal damage to players on nether roof. Are there any plugins that can do that?
if(y >= bedrockHeight) {
p.damage(10000);
}
@frigid ember on which event?
uhhhhh
Id say put it in a BukkitRunnable not an event
PlayerMoveEvent
check if e.getFrom().getY() >= bedrockHeight
or p.getlocation().gety()
once they move, if their prev position y >= bedrockHeight
they will get damaged
or you can make a tick async runnable with bukkit scheduler
p.damage works async ?
force that sync
it's possible to get to nether top without teleport?
Does it have any big performance impact on the server?
yeah it is klug
when you exit a minecart or teleport are those events hookable?
So should I do it sync or async? Async seems to be more resource friendly, doesn't it?
Async will not slow a tick, but I'm not sure you can damage a player async
same
I mean, it's basically exiting minecart, or enderpearl, or teleport to get to y>128 in nether, so if those can be hooked in any way, better than running a conditional every move
you can't
so id use a playermoveevent
Custom event
Which is better bukkit scheduler or player move event?
Depends
player move event, it will only damage once they move
so if they afk on it, it wont damage
if ur gonna risk for better performance do that
i guess
Better for performance and it should deal damage in 100% cases
wonder if you can set a per world max height'
rather than a runnable every tick
Retrooper, the first message wasn't meant for you...
?
meaning, generate the nether with a max height of 128
Oh wait, sorry it wasn't you who reacted to it xD
World nether = // GET NETHER
nether.getPlayers().forEach(player -> {
if (player.getLocation().getBlockY() < height°
player.damage
Ok, thanks guys. I think that's what I needed
suppose depends if you want to suffocate, instantly kill or discourage with damage
why lambda
u are sacrificing for worse performance xd
lmao
yea use tick scheduler
then
would be more interesting to let them get up to the nether top, but then make their movement so slow, they can't do anything
its better to have it time based than based off of their movements
talks about using playermoveevent which has shitty performance because it fires every time a player moves and checks if players y >= netherHeight
complains about performance because this guy wants to use lambda
nice
ya dont get jokes dont you
how do you convert a nms ItemStack to a CraftItemStack
I cant cast it
ya dont get jokes dont you
it was really funny
#nohomor
Why do you need a CraftItemStack ?
This is ItemStack not CraftItemStack
that's the opposite isnt it
You wanted nmsItemStack to ItemStack
craftitemstack can be casted to bukkit itemstack
hey guys I was wondering to update to the last build of a plugin do i just need to replace the .jar file in my plugin folder ?
yes verilou
Yep, but some plugins will need to update the config files too, check it on the page
you might want to delete the config if it tells you to or if the plugin doesnt seem to work
Ok thx 😄 and do you know how to keep trace of all the new build of evry plugins ?
this whole fiasco with dimension identifiers and NBT in login and respawn packets is a PITA.
I'd recommend using an autoplugin updater... plugin
ok
something like this https://www.spigotmc.org/resources/plugin-updater.48415/
but probably with higher reviews
and more updated
who cares, in the end i wanted a bukkit itemstack anyway
When I start bungeecord, completely clean install, no plugins I get this error.
09:29:42 [SEVERE] java.lang.ClassCastException: java.util.LinkedHashMap cannot be cast to java.util.Collection
09:29:42 [SEVERE] at net.md_5.bungee.conf.YamlConfig.getListeners(YamlConfig.java:234)
09:29:42 [SEVERE] at net.md_5.bungee.conf.Configuration.load(Configuration.java:85)
09:29:42 [SEVERE] at net.md_5.bungee.BungeeCord.start(BungeeCord.java:273)
09:29:42 [SEVERE] at net.md_5.bungee.BungeeCordLauncher.main(BungeeCordLauncher.java:62)
09:29:42 [SEVERE] at net.md_5.bungee.Bootstrap.main(Bootstrap.java:15)
