#help-archived
1 messages · Page 83 of 1
that's not that far tho
that's most likely the spawn loaded chunks or however is called
yeah
it seems my backup may have failed
but in my not backup they go up to 7 5
but only as far as 2 -1
r.0.0.mca
r.0.-1.mca
r.0.1.mca
r.-1.0.mca
r.1.0.mca
r.-1.-1.mca
r.-1.1.mca
r.1.1.mca
r.1.-1.mca
r.-2.0.mca
r.-2.-1.mca
r.-2.1.mca
r.6.4.mca
r.6.5.mca
r.7.4.mca
r.7.5.mca
it seems fine
ok thanks for the help i will see if this backup works
@tiny dagger this hasnt changed anything, the region files are there but it seems like all edits to the nether are gone
could this be to do with switching from fabric to spigot? the only plugin i have installed is core protect
Question, is maven important or just a preference?
is there a way to monitor all currently loaded chunks?
Caused by: java.lang.IllegalArgumentException: Parameters not allowed in this parameter set: [<parameter minecraft:damage_source>, <parameter minecraft:killer_entity>, <parameter minecraft:last_damage_player>]
anyone know what that means
Can anybody help me with dynmap? I made a world border then did /wb fill, then I added dynmap and did /dynmap fullrender, and there's still huge chunks of black on the dynmap. The fullrender isn't finished yet but the black chunks haven't gone anywhere after almost 24 hours of fullrendering.
It's also not that big of a map inside the world border, only 5k x 4k
Hi, is anyone else having trouble searching for spigot plugins? Whenever I go to search for the the only way it will search is by Last Update, even when I have any other option selected
anybody know why lava and water dont flow on my server?
Quick question what would getItemInHand be now?
@wanton vine if you have worldedit installed try /stoplag-c
it says all intensive server activity is now allowed
@frigid ember getItemInMainHand and getItemInOffHand respectively
That’s should’ve fixed it
That should’ve *
@torn robin getItemInMainHand isnt a thing.
Any other plugins?
a lot
@frigid ember Player#getInventory#getItemInMainHand ?
If I have a 4K custom world that I want players to explore apart from survival, shud I use Multiverese or Bungeecord for it?
literally right now haha
@torn robin could you help me with my problem?
Put it in here and anyone can give advice Janny
@latent rock do you just mean a big world? What version is it?
1.15.2
I wouldn’t use either, I’d probably pre generate it so it isn’t too laggy
Look at world border, it should do what you’re looking for
i have it
is there a way to pm everyone on the server?
with a command?
You mean your MC server @storm vessel ?
Bukkit.getOnlinePlayers().parallelStream().forEach(p -> {
Bukkit.dispatchCommand(Bukkit.getConsoleSender(), "pm " + p.getName() + " " + message);
}
What temedy said
Is that possible
Idk why you would want to but yes it’s possible
I don't want to have to write a whole new plugin
Uhhh
Bukkit.getOnlinePlayers().parallelStream().forEach(p -> {
Bukkit.dispatchCommand(Bukkit.getConsoleSender(), "pm " + p.getName() + " " + message);
}
@storm vessel
Can I ask for a little development help here?
yeah
I don't want players to know that other players received the message
They wont?
and I'm currently trying to have my plugin generate Essentials Shop signs
like Buy/Sell
I have signs creating with the proper formatted text on them
uhh essentials
I'm already hooking into essentials to get prices from worth.yml
EssentialsX
yeah sorry this is kinda a specific question
Im not familiar with essentials, that is some real shit code
Idk If essentials works that way
yeah I'm lost as hell in it
I'm just tryin to figure out if theres a good way for me to do this
I looked
it seems like they check for new signs onSignChangeEvent
eh
So I'm not sure how I should handle that
just use PlayerInteractEvent
There’s probably an api method in essentials
can I call that event?
and check the state
if(event.getClickedBlock().getState() instanceof Sign) {
//Do stuff
}
You could call sign change event, shouldn’t be too hard
Temedy are you saying to recreate how essentials handles buy/sell signs
I'm lost with that
Bukkit.callEvent
why do you need to call event
You can create a event with
new SignChangeEvent(Params)
So essentials registers the sign temedy
Creating ur own event isnt really good but ye
Yeah I wanted to see if there was a way I didn't have to create my own event
Agreed but I can’t think of a better solution unless there’s an api specifically for that
Like I feel like there has to be a better way
but I still do not know exactly, what are you trying to accomplish
then just use PlayerInteractEvent
Yeah okay that's what I've done so far
And I'm generating signs
they're just not registering as essentials shop signs
public final class Main extends JavaPlugin {
@Override
public void onEnable() {
Bukkit.getServer().getPluginManager().registerEvents(new Listener() {
@EventHandler
void onInteract(PlayerInteractEvent event) {
Player player = event.getPlayer();
if(event.getClickedBlock() != null) {
if(event.getClickBlock().getState() instanceof Sign) {
event.getClickedBlock().setType(Material.SIGN);
}
}
}
}, this);
}
}
prices:
stone: 1.0
cobblestone: 1.0``` I have this config section and i try looping over it but it throws an NPE ```java
config.getConfigurationSection(rootKey).getKeys(false).forEach(sKey -> {``` so i logged `rootKey` and it prints null but it shouldn't, any ideas?
I have no idea how to make it work with essentials, as I said its some real shit code
what is rootKey mason
Lemme find one more thing and ask
I'm not fantastic at Java lol
public void loadPrices() {
final File essentials = new File("plugins/Essentials/worth.yml");
final File config = new File("plugins/ChestSellV2/config.yml");
if (essentials.exists()) {
Bukkit.getLogger().log(Level.INFO,
"Essentials has been found. If you wish to use this enable it in your config.yml by setting essentials-price to TRUE.");
if (getConfig().getBoolean("use-essentials-worth-yml")) {
Bukkit.getLogger().log(Level.INFO,
"This plugin is configured to use Essentials worth.yml");
parseConfigFile(essentials, "worth");
return;
}
}
parseConfigFile(config, "prices");
}``` a bit ugly but its a rough work up parseConfigFile is just a call method for the looping
Wait how do you send code in this?
Markdown
Ah okay
Nope logging rootKey prints null
[CODE=java]public class SignCreateEvent extends SignEvent {
public SignCreateEvent(EssentialsSign.ISign sign, EssentialsSign essSign, IUser user) {
super(sign, essSign, user);
}
}[/CODE]
I just 100% thought that was markdown
ah that bbcode lol
@brisk mango its commented out because i had to log so without looping it still prints null just logging rootKey
yeah just did
public class SignCreateEvent extends SignEvent { public SignCreateEvent(EssentialsSign.ISign sign, EssentialsSign essSign, IUser user) { super(sign, essSign, user); } }
so the issue lies with rootKey
well if prices is an section
it cant be null
yeah but how about the parseConfigFile
apparently it is
what are you doing there
public void parseConfigFile(File file, String rootKey) {
final YamlConfiguration config = YamlConfiguration.loadConfiguration(file);
System.out.println(config.get(rootKey));
}```
Is where i log rootKey
And thats where it prints null
im not sure what .get does
Print rootKey
null
So if that's the API code for essentials SignCreateEvent,
Not get(rootKey)
oh i see
if you print out only rootKey its not null
one sec
lol
its because youre doing config#get
because get gets an object in a path not a section
im not sure too
so just do
good call
config.getConfigurationSection(section).getKes(false).forEach(key -> {
}
You guys have any ideas for where I could look or places to ask about the Essentials Signs?
Why are you asking in spigot discord lol @fathom shard
no one is alive in TSC :P
ah, there is some big noobs in this discord
Nowhere I should ask?
ask someone that knows how to work with essentials
im not familiar with it @upbeat linden
?
I'm so new to plugin development I have no idea where to ask about stuff
You still talking about the Signs?
Edit this to change the output of the command!
yeah I am
@brisk mango i love this shit lol i just printed getConfigSection(rootKey) and printed the rootKey right now i go to for Each and its erroring again love it
Did you try recreating a SignChangeEvent?
Alright fair
4eh you getConfigSection(rootKey).getKeys()
well I appreciate this a lot
I mean if thats in a different class and the null pointer errors on that line, the config could be null, anything, but I havent seen all of the code so i cant really tell, with the code you sent, there cant be nothing wrong with it @fathom shard
thanks so much @brisk mango @torn robin
Then you loop through each key and add rootKey + “.” + key to get the value
nope same class config is not null, its just being an ass as usual
👍
can you send me full class
im not proud of it to send it so let me clean test if it doesnt work ill come back
public void parseConfigFile(File file, String rootKey) {
final YamlConfiguration config = YamlConfiguration.loadConfiguration(file);
config.getConfigurationSection(rootKey).getKeys(false).forEach(sKey -> {
final Double price = config.getDouble(rootKey + "." + sKey);
this.prices.put(sKey, price);
});
System.out.println("[ChestSellV2] A total of " + this.prices.size() + " items have been registered.");
}``` I removed a bulk of code that really was worthless
wait now that doesnt make sense really hm
you know that you dont have to make the Double non-primitive
i mean that makes no sense to me why would it be null
config.getConfigurationSection(rootKey).getKeys(false).forEach(sKey -> { } ``` is line 97
where its throwing the error
The forEaches are much harder to read than regular fors
bruh this fucking java shit is killing me
no they arent
its just easier and faster to use a consumer
It’s an opinion
Print out they keys of the base file
config.getKeys
Print that out please
only hard to read if you dont know lambda @torn robin
I’m on mobile
well you said in general its much harder to read, w/e
In general fors are easier to read for me
Again, it’s an option, you don’t need to correct or dictate peoples options
isnt the file null @fathom shard
nope
I'm looking for a plugin that can make edits to the mob cap, can anyone reccomend anything?
@velvet scaffold spigot.yml probably
Can you print out the keys of config?
config.getKeys()
me?
bruh
he is doing a forEach method which means its already null
why should that help that
[] empty but it shouldnt be 🤔
the only thing i could think that is null is config but no idea
show screenshot of config.yml
Where are you calling parseConfig?
look above
I don’t see it
i call it on loadPrices method that will read the section to be used on a vent later
event*
I mean alot of weird shit happens to me too and it doesnt make any sense
like java not being to able access an public class
I have no idea honestly, this code should work
maybe try restarting intellij and check if the code is there
lol
System.out.println(config.getConfigurationSection(rootKey)); is null
nothing with intellij
i already tried
only guess is my config is messed up?
i dont see anything in the spigot config file for mob cap
I think its spigot and java that is messed up lmao @fathom shard
maybe bukkit.yml?
@fathom shard last time can you output config.getKeys
im looking for something that is able to increase the mob cap based on number of players online (essentially to increase the efficiency of farms when many players are afking farms)
Wack
as i said above
bruh it has nothing to do with the file its just the keys that are null @torn robin
Which is from the file
public void loadPrices() {
final File essentials = new File("plugins/Essentials/worth.yml");
final File config = new File("plugins/ChestSellV2/config.yml");
if (essentials.exists()) {
Bukkit.getLogger().log(Level.INFO,
"Essentials has been found. If you wish to use this enable it in your config.yml by setting essentials-price to TRUE.");
if (getConfig().getBoolean("use-essentials-worth-yml")) {
Bukkit.getLogger().log(Level.INFO,
"This plugin is configured to use Essentials worth.yml");
parseConfigFile(essentials, "worth");
return;
}
}
parseConfigFile(config, "prices");
}```
Logically, when a YamlConfiguration is not null, then File cant be because YamlConfiguration uses file as an parameter @torn robin
i have to use File to use essentials worth
are you using essentials
otherwise id just default to FileConfiguration
in this instance no but i cant limit that
want me to try using FileConfiguration?
shouldnt be any difference
but i cant
lol if i need to access essentials
unless i can load a File to FileConfiguration
okay nailed it down
YamlConfiguration.loadConfiguration(file);
is the culpret
without it loads and prints fine
with it prints null
lol i dont get this
unless its final File config = new File("plugins/ChestSellV2/config.yml");
but that makes no sense
like at all
Hear me out
i mean its just because of spigot
What if you used the essentials API to get the prices
because they might wanna use my prices
i mean realisticaly
i could just transfer the essentials file and force them to configure via mine
Question: Is it efficient to update mutliple config nodes even when you don't necessiarily have to update all the config nodes, but just to ensure that order of config nodes is correct?
yeah imma do that
4eh you could allow an override file
and if it’s not in that file just default to essentials’
@frigid ember i dont understand your question
@frigid ember doesn’t sound efficient but if you care about order ig why not
As long as it isn’t like 200 keys you should be fine
Edit this to change the output of the command!
YAML files* or loading shit into memory
not even json
DB is the best
that other shit isnt worth it
especially if you store alot of data
@brisk mango its public well im making it in return i get a permanent free MC server so
data management mostly
mk
I was doing 1.13 not sure if asynclogin wasn’t deprecated
Oh also @brisk mango u got a good way to load a prices.yml?
Good deal 4eh
so instead of using config i use a new file
like create the file and etc?
well a way to create it and use it as like another FileConfiguration
and then read the keys from that
I mean i dont have a FileConfiguration way but ive got this
so long as i can for each the config section and get what i need it's all good
public final class DataFile {
private final Main plugin;
private final String name;
private File file;
private YamlConfiguration config;
public DataFile(Main plugin, String name) {
this.plugin = plugin;
this.name = name;
}
public boolean setup() {
file = new File(plugin.getDataFolder(), name);
boolean succeded = false;
if (!file.exists()) {
try {
succeded = file.createNewFile();
config = YamlConfiguration.loadConfiguration(file);
} catch (Throwable reason) {
throw new RuntimeException(reason);
}
}
return succeded;
}
public void save() {
try {
config.save(file);
} catch (Throwable e) {
throw new RuntimeException(e);
}
}
public void reload() {
config = YamlConfiguration.loadConfiguration(file);
}
public YamlConfiguration getConfig() {
return config;
}
}
@fathom shard
@frigid ember i dont understand your question
@brisk mango I have a game that will have multiple spawn points (an unknown value), and the user can set spawn locations with world,x,y,z,yaw,pitch values. The setup for the config looks something like this
Arenas:
Test:
name: "Test"
otherstuff...
Teams:
red:
'1':
world: World
x: 100
y: 100
z: 100
yaw: 100
pitch: 100
'2':
...etc...
My issue is when I add a new point and how would I go around figuring out what the last node for the list of spawn points.
Does this make more sense for what I'm trying to do?
If there's already written information, how do I know to set a 3 instead of a 7 for the next node of information for a spawn point.
And yes, this is also being stored in memory as well, but I can't guarentee that the memory will match exactly what the file reads.
YAML files* or loading shit into memory
@brisk mango And yeah, I would use a DB but it's a pain to setup with the amount of information I'm wanting to store.
its 2:32am i mean wow* XD
oh i see okay ill take a see and see, thanks
@frigid ember i mean this is just painful to store this information in a YAML then get it
it gets really confusing especially when its like this
Like, having an arena and each arena having an team and each team having an location lol
You have to store the amount of locations somewhere
in the yaml
and then get it + 1
@fathom shard just make an instance of the class and call the setup() method in onEnable()
It can be a bit confusing at first definitely
and then just make an method in the class that returns the instance
so
DataFile file = plugin.getDataFile();
@frigid ember assuming you know about config sections you’d set the next key to the amount of keys+1
oh those are keys im stupid
just do
int size = ConfigurationSection#getKeys(false)#size()
and size++
when setting another location
Hmm, yeah I guess if I'm careful enough I can make the memory and config consistent. but otherwise im dead x.x
I’d probably assign names to the spawns/teams
Oh I see 👌
Like there are PointLocations and RegionLocations (which store two locations) and PointLocations have two types: SPAWN and RESOURCE. And RegionLocation has 3 types: NEXUS, CAPTURE, ARENA. So they have different types
But the user can have multiple of the SPAWN type and multiple of the CAPTURE region type. soooo yeah this can be complicated. I think I will give each spawn a name just so it is easier to find and locate these.
Just make a class that contains all the methods.
and give them more descriptive names
@fathom shard wait I mean, if the file already contains the stuff you dont need to load it
just load it once when the plugin enables and it shouldnt be null
maybe its fucked up if you loadConfiguration
maybe it doesnt have enough time and youre calling methods
or idk
@brisk mango nah basically, i have the resources but i need to create that file inside the datafolder but its not copying over the data
just the file name
No idea
so i need to make a good way to do that
like saveDefaultConfig() but for prices
perhaps i could take a look at sourcecode
wdym
nvm
ignore what i just said
but honestly i have no idea why its working maybe ask someone in TSC but i dont think they will help you @fathom shard
because this doesnt seem to be ur issue
Quick question
I released a new plugin
If you want review the code
Main
https://paste.md-5.net/xozikinelo.java
AutoPrestigeCommand
https://paste.md-5.net/ekiqayonoy.java
AutoPrestigeManager
https://paste.md-5.net/lisumivile.java
PrestigeRunnable
https://paste.md-5.net/yogazamoxu.java
@subtle blade
Since choco is the best at reviewing code
Never call methods from constructor
Because the work in the constructor is bad
its not used to do any work in it
its used for constructing objects
Where
when you register your command.
in the DI
Also BukkitRunnable is an piece of shit class
You mean like setting the command executor?
use BukkitScheduler instead
Well I didn’t know which one to use, I forgot ok?
ublic AutoPrestigeCommand(AutoPrestige plugin) { this.plugin = plugin; plugin.getCommand("autoprestige").setExecutor(this); }
remove plugin.getCommand
Anyway, you should never call any methods from a constructor, because the work in the constructor is bad, the object isnt fully initialized yet and youre calling methods, you just shouldnt, but you can call private methods iirc, but never call overriden methods, you can actually run into some weird issues, because the method can be called before the class constructor, i dont know how its called atm, but an exception would be thrown
Are you saying from within the class itself or ever
Well it works perfectly
You can call private methods but you shouldnt
Like are you saying don’t call static methods
but you cant call overriden methods
since you can run into some issues
it has its name, i just cant remember atm
When you mean calling methods from a constructor you mean
Basically, any methods in a constructor are bad
opposed to the builder pattern?
Oh within the constructor.
I thought you meant ProfileBuilder().setName("Nermin").create();
Oh my fucking god
I love when I use getInstance then people are like use Class(MainClass)
Lol
That would indeed make sense
There's not even a difference between the 2.
Then now when I use Class(MainClass) people tell me to use getInstance
There is a difference between a singleton and dependency injection.
Like WTf do I use
People suggest using the Singleton pattern.
No , they dont and that is wrong
I recommend DI
Singletons are never better than dependency injections, dependency injection is more testable/reusable, explicit cohesion and defined ordering of how classes are used
Same
Okay you're just rambling junk now.
Can I ask a question?
Main
https://paste.md-5.net/xozikinelo.java
AutoPrestigeCommand
https://paste.md-5.net/ekiqayonoy.java
AutoPrestigeManager
https://paste.md-5.net/lisumivile.java
PrestigeRunnable
https://paste.md-5.net/yogazamoxu.java
Use-case for grabbing the main class there can't be a difference.
Omfg here we go
Explian those reasons in depth shall you?
Don't just go off of words you've heard from other people.
If I'm wrong, I'm wrong; prove it.
@paper compass post it on the forums if you want thorough feedback
Yea will do
Why DI over SP
Dependency injection doesnt cause memory leaks, also you cant run into weird null pointers while with a singleton pattern you can, also dependency injection is more reusable, more testable and defines ordering of how classes are used
DI is object oriented and follows SOLID principles
your question doesnt make no sense, you cant add NMS stuff
We may need multiple help channels lmao
2nd that
Doesn't SP also follow principles?
Could you also explain what you mean by NP's and Garbage Collection?
lol
I just want people to review my code I made in like 10 mins
Not for an arguement to happen
@tough viper anythinf specific?
Main
https://paste.md-5.net/xozikinelo.java
AutoPrestigeCommand
https://paste.md-5.net/ekiqayonoy.java
AutoPrestigeManager
https://paste.md-5.net/lisumivile.java
PrestigeRunnable
https://paste.md-5.net/yogazamoxu.java
mainly worlds
We're not arguing; some people just get offended easily.
so I can do World.setType
Garbage collector doesnt work on singleton pattern, since it gets loaded in memory and stays there, while it works on DI, because it only gets called from the class constructor when being constructed. @frigid ember
Why do you want to set its type?
@paper compass I already reviewed your code and said the couple things you have wrong and you can improve.
Could I do
@paper compass use ChatCokors don’t hardcore the color symbols
Whats the reason @torn robin
There is none difference between those two
Not again
How would I do nmsWorld.setType
The chat color enum is globally supported and doesn’t mess with file encoding
I haven't found arguments for it
((CraftWorld)world).getHandle() @tough viper
Reflection probably Procez
Lmao
What are you trying to do @paper compass
Nerm, what do you mean by going off with words that ive heard, its things I know from my java experience and are generally known @frigid ember
DI has always been better than a singleton pattern.
So I just made my own and uploaded it
Typically when you go at a person saying their brain-damaged kind of shows that you've been triggered in 1 way or a nother 😆
I might've been wrong
The auto prestige manager looks very useless
Meh
What's next? To attempt to distraught someone?
Yeah, because youre trying to say a SP is better than a DI , whatever
I can easily do stuff faster imo
@frigid ember shut up your not helping go to general
Single sided ^
Anyways back to the topic, you can't say you've always been right? Everyone's been wrong
here and there several times etc
They are basically the same lmao
Guys this is help not prove-yourself-right
In one way or another they are still accessing a class
Never said I was always right, anyway can we just end this discussion? DI is better than a SP, no point arguing no more
Done.
setTypeAndData(BlockPosition blockposition, IBlockData iblockdata, int i)
@paper compass what do you need again?
What is int i
I believe someone already reviewed it?
Meh
@paper compass I mean i dont know what is your point, I reviewed the code and pointed out a couple things that can be improved/are wrong.
I use BukkitSchedular instead of BukkitRunnable in extends right?
yes.
What’s the difference
I dont know whats the point of making an own runnable class though?
BukkitScheduler is better in performance. BukkitRunnable is an piece of shit class, every method synchronized and throwing 5 exceptions, its basically thread-safe
BukkitRunnable is outdated iirc
Ah right
I just forgot which to import because I was just making this for my prison server
Something like with Random java class, its better to use ThreadLocalRandom rather than creating new random objects, since it will always have its own thread and wont be thread-safe
Well yeah
I always use ThreadLocalRandom
Random is on the main thread ThreadLocal is on another thread
Correct?
no
Random is thread-safe, meaning it can be used from another thread or from the main thread, but that will make it have worse performance when its between threads. ThreadLocalRandom always runs on the thread where you use it and each ThreadLocalRandom has its own thread seed
Which means its not synced, and it has a better performance
Oh kk
I mean if you say that, you probably dont really know how threads work in java lol
Random doesnt always run on the main thread, depends if you use it on the main thread or not, it can be used Asynchronously or synchronously but that will cause it to have less better performance than getting an current random from ThreadLocalRandom class
never
you shouldnt create new random objects
then what do you use to get a random number?
(What we were just talking about)
Lol
sorry just been writing some rtp code and was using Random
What packet corresponds with Acknowledge Player Digging [0x08] I can't find
Can't find any?
@brisk mango u got a sec (sorry im being a pain)
yes sure
so im trying to serialiase a location and save it but its throwing https://sourceb.in/f535bb01d0
public static void writeToFile(HashMap<Location, List<UUID>> input, File file) throws IOException {
ObjectOutputStream out = new ObjectOutputStream(new FileOutputStream(file));
out.writeObject(input);
out.close();
}``` is my code
Location isnt serializable
wait what i swear it is
well time to make a new instance of location that is
No need to
public String serializeLoc(Location l){
return l.getWorld().getName() + "," + l.getBlockX() + "," + l.getBlockY() + "," + l.getBlockZ();
}
public Location deserializeLoc(String s){
String[] st = s.split(",");
return new Location(Bukkit.getWorld(st[0]), Integer.parseInt(st[1]), Integer.parseInt(st[2]), Integer.parseInt(st[3]));
}
I can’t format code I’m on phone
@fathom shard
.<
‘Test’
Location is config serializable
Nope
I’m on phone
Guys what if my phone charger just electrocuted me
; _ ;
plugin.getConfig().set("location", location); //serialize
Location location = (location) plugin.getConfig().get("location"); //deserialize
``` @fathom shard @brisk mango
Lol @brisk mango knows nothing
[03:50:38] [Server thread/WARN]: java.io.NotSerializableException: org.bukkit.Location are you sure about that @velvet halo
Yes I am
@paper compass was that an joke right
You are probbly doing it wrong
@fathom shard
Look at the javadocs
its config serialisable
im not using YAML
Oh
therefore Temedy is right no?
Use mine then
public String serializeLoc(Location l){
return l.getWorld().getName() + "," + l.getBlockX() + "," + l.getBlockY() + "," + l.getBlockZ();
}
public Location deserializeLoc(String s){
String[] st = s.split(",");
return new Location(Bukkit.getWorld(st[0]), Integer.parseInt(st[1]), Integer.parseInt(st[2]), Integer.parseInt(st[3]));
}
Heh
as of right now no im using .bin
I mean , a stack trace shouldnt lie
it will be json
Why not just make an encapsulation class @paper compass That doesn't seem good
just gotta recode some shit first
I haven't tested the performance but it is generally said to be faster
i'd prefer DB over anything
public class JsonStorage {
private static final Gson GSON = new GsonBuilder().setPrettyPrinting().create();
public static void write(String path, Object object) {
File file = new File(path);
if(!file.exists()) file.mkdirs();
try (BufferedWriter bufferedWriter = new BufferedWriter(new FileWriter(file))) {
GSON.toJson(object, bufferedWriter);
} catch (IOException e) {
e.printStackTrace();
}
}
public static <C> C read(String path, Type type) {
File file = new File(path);
if(!file.exists()) file.mkdirs();
try (BufferedReader bufferedReader = new BufferedReader(new FileReader(file))) {
return GSON.fromJson(bufferedReader,type);
} catch (IOException e) {
e.printStackTrace();
return null;
}
}
}
``` If you want a simple class todo it
@brisk mango It depends what you need to store
If you need to store a location then you should store it locally instead of a database
why does final EconomyResponse response = plugin.getEconomy().depositPlayer(player, totalSale); throw an NPE and yes i have vault on plugins
man im rusty asf
How do you register economy
Look at vault api documentation
I’m asking him
No you shouldnt rely on other people
Lmfao
private boolean setupEconomy() {
if (getServer().getPluginManager().getPlugin("Vault") == null) {
return false;
}
RegisteredServiceProvider<Economy> rsp = getServer().getServicesManager().getRegistration(Economy.class);
if (rsp == null) {
return false;
}
economy = rsp.getProvider();
return true;
}```
Do you setupEconomy in onEnable?
Yes you have too
iHusker bruh
So how do you get the player then?
Perhaps player/totalSale is null
Show us your PlayerInteractEvent
its on a player event so using the event method
well that doesnt give more information since its just an null pointer
shouldnt it be Economy instead of EconomyResponse? @fathom shard
No
https://sourceb.in/c710f512aa dont judge im gonna recode
did you use DI to get an instance of main?
of course
I hate singleton lol
Show us how you setupEconomy
Edit this to change the output of the command!
I meant in his onEnable
yeah, exactly, you shouldnt be getting null pointer idk why ur getting it @fathom shard
no needed for that, its just enough info that he said he calls the method.
is full main class
Please use
if (!setupEconomy() ) {
log.severe(String.format("[%s] - Disabled due to no Vault dependency found!", getDescription().getName()));
getServer().getPluginManager().disablePlugin(this);
return;
}
Why exactly
just debug lol
if you have the plugin.yml load set to STARTUP it ended up failing to load vault in my experience
yes.
Also put softdepend: [Vault] in the plugin.yml
Try that
it hard depends without vault it fails why would i use soft
No, that doesnt change anything
It makes the plugin load after vault loads
either way
Its not a start time error
its a error after everything loads
load order in my instance does not matter
^
nope, i'd still implement the check. just because vault is installed doesn't guarantee there is an eco provider
Just vault load after or before your plugin loads @fathom shard
Just a quick check
Bruh what does that exactly change, its not a start time error, can you read
that litterly changes nothing
do you actually have an eco plugin installed?
LOL okay so no vualt apparantely
its there tho
This is why I said put
if (!setupEconomy() ) {
log.severe(String.format("[%s] - Disabled due to no Vault dependency found!", getDescription().getName()));
getServer().getPluginManager().disablePlugin(this);
return;
}
so like what?
which is why you should utilize the return type of the setup method lol.
the debug message is misleading tho. it could mean there is no eco provider, not necessarily that vault isn't installed
why softdepend
Uhh
it could be only plugins are vault and this let me grab an eco rq
didnt think I NEEDED
an eco
Ah
no need for softdepend. leave it as regular depend, and you can remove the plugin check.
So you don’t even have an eco plugin?
vault doesn't provide an eco. it's simply an interface for eco and perms
to sum up what you need:
- leave as depend in your plugin.yml
- remove plugin check
- use return type of setup method. if false -> no eco provider (no essentials, iconomy, etc), disable plugin or at least the eco features. if true -> proceed as normal
How would I make aspects of my plugin not trigger anti-cheat plugins?...
or should I just make my own anti-cheat...?
yeah.
otherwise, you cant
If you’ve never make an anti cheat I wouldn’t recommend making it @radiant pollen
They are hard to make
Imo
Well I need to do something.
Yeah.
The main problem is I have things that set player velocity and they're a false positive 100% of the time.
What Antichrist plugin is it
Cant do nothing with that if its another plugin triggering the checks.
Lmfao autocorrect
Antichrist
LOL
Autocorrect lmao
Lol noob
ACR
To be honest, you’d be better off either a) developing your own (good luck) or b) make an override permission that u can give to players that the anti cheat will ignore to do what u want assuming the anticheat will allow for that
Otherwise option c is not have an anti cheat
Unless designed specifically for your needs of the server likr Hypixel most of the time at best they are irritating plugins that can cause issues with general players
Try using the “AntiCheatAPI” class to exempt the player for a bit then unexempt them
good lock LOL
My fix lmao
i like your responses 4eh
Yeah, making the player exempt for a few ticks might be the best thing to do.
😄
Thanks
Np
@brisk mango im not wrong tho lol
Public anticheats are never really well designed anyway
Anti cheats imo need to be tailored specifically to your needs
It seems to be pretty good. The config is extensive.
Wow
Everything I do in my minigame would be considered hacking somewhere else and it's detecting all of it so
Never used many anti-cheat plugins before.
Lmao
Antigamingchair is actually not that good, I hacked for 10m and didn’t get banned
.<
I love how hypixel made watchdog MachineLearning but it hardly learnt anything because it never bans
Even though like 20% of their player base are hackers
Explain
no better outta there
I hacked for 10 mins
no need to explain
yeah, because it has many phases and checks
to actually confirm if ur cheating
Blatant killaura
maybe if you had some iq you would get it, it doesnt ban instantly
yeah, it doesnt ban instantly so there is minimum percentage of people who get banned and are legit
ooof
yeah and after 10 mins you get banned though ?
I just quit
It was getting boring af
bruh i have my opinion and sure other ppl do aswell so lets just not argue about this no point
Singleton and dependency are basically the same, they both get a class no matter what
Kk I’m off to sleep
Can anybody help me with dynmap? I made a world border then did /wb fill, then I added dynmap and did /dynmap fullrender, and there's still huge chunks of black on the dynmap. The fullrender isn't finished yet but the black chunks haven't gone anywhere after almost 24 hours of fullrendering.
It's also not that big of a map inside the world border, only 5k x 4k
@fathom shard maybe you can get exerosis sometime here so he can bully these noobs
“bully these new players” how old are you? 5? Imagine using noob as an insult.
if you have as much experience with java as i do, you will understand what im saying
Ahahah
what youve basically said is a non-sense
How much experience do you have just wondering
“bully these new players” how old are you? 5? Imagine using noob as an insult.
yeah should definetly bully these spigot noobs that are trying to teach people and just mislead them instead, just like bunch of fucking kids that have no idea what are they doing
wtf
With dependency injection you cant get null pointers while with a singleton pattern you can, also dependency injection is more reusable, more testable and defines ordering of how classes are used
But I’m just saying that they both get a class
yeah I get your point. Im just saying that its a better practice to use a DI.
I use DI
But theres nothing wrong with SP too. It's just really better using di
Also, I doubt you knew that
I love when I use SP people tell me to use DI, and when I use DI people tell me to use SP
It’s really confusing
Its not confusing, just remember the reasons why its better to use DI rather than a singleton
Its those people that have no idea what theyre saying
and have basically no knowledge in the language
I basically did because with a singleton you actually need to define it in order for a NPE not to produce
just because they've "heard" a SP is better than a DI then they say it.
yeah, with dependency injection you dont. Because it uses the class constructor
thats a quite good reason too.
So I did know it 😉
Kk nerd
thanks
cya
does anyone know of a way to make mob spawning behaviour / mob cap act like each individual player on a server has the same mob spawns as single player?
I feel like i saw somewhere paper has this as a feature in the config files, can someone confirm or deny this?
@velvet scaffold Yes, you can do this with paper
i think default settings should be basically vanilla and then you can adjust to recommended settings if you desire
but sadly the out-of-box experience is like buying an iphone on ebay
mob-spawn-range: 8 that's literally the only spawn option not the same as vanilla
and even then its only not the same if your view distance is >= 7
which for most servers it isn't anyway
view distance 10 --> 6 is basically 3x less load on the server
makes a huge difference
how do I prevent a mob from despawning with Spigot?
Thank you!
Is anyone able to help me figure out some problems I am having with my capture the flag plugin?
?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.
Sorry, I am having some issues with resetting the flag. I need to be able to create a banner with the same pattern, location, and rotation as the original. I am not getting any errors but neither the pattern nor rotation is working.
have you tried asking the author for help in their thread?
No, I am writing the plugin from scratch
ok well perhaps share your code then
public void resetFlags() { for (Map.Entry<Location, Flag> flag : this.flags.entrySet()) { flag.getValue().startPos.getBlock().setType(Material.BLACK_BANNER); ((Banner) flag.getValue().startPos.getBlock().getState()).setPatterns(flag.getValue().flagPattern); flag.getValue().state = "base"; Bukkit.broadcastMessage(flag.getValue().name + " has been reset"); } }
Okay, how do I update a blockstate?
by calling .update
Okay. Thanks I'll try it!
BlockState bs = //; bs.setPatterns; bs.update
Great! The Pattern updates now, but do you know how to set the direction? I know you can set data based on a number for north, west, east, south but how would I get that from the Location? Or is there a better way?
You mean get a direction from yaw/pitch?
I think? I have never tried anything like this before, I just need the banner facing the same direction
you can make an array of BlockFace
well a 3-tuple location (x,y,z) won't have a direction
only a 5-tuple (x,y,z,yaw,pitch) will
private static final BlockFace[] ORDERED = new BlockFace [] {
NORTH, EAST, SOUTH, WEST
}
and make a method that returns BlockFace from a location
I'm using the API location class so I assume I can get the yaw, pitch and block faces
How do I set which direction the banner is facing from this though?
1 second
private static final BlockFace[] ORDERED = new BlockFace [] {
NORTH, EAST, SOUTH, WEST
};
public static BlockFace fromYaw(float yaw) {
return ORDERED[Math.round(yaw / 90F) & 0x3]
}
@grand aurora
Thanks!
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.
um I think you only have to be registered on spigot
I know the answer to this
But I was wondering if theres any hope
Is it possible to make someone riptide
forcibly
what does mean riptide @dry kiln
maybe NMS
Also, is there any benefit to the way I am doing the reset vs storing the block data as a string and setting it with Bukkit.getServer().createBlockData()
Document found = (Document) Mongo.getCollection("mc").find(new Document("UUID", player.getUniqueId().toString()));
``` good question why does this return null
wait
nvm
Does anyone recommend using Guava for cache or should I utilize something different?
Guava is fine
I don't like the sound of fine xD
I want to make sure Guava is reliable and efficient
I dont know what do you honestly expect tbf, guava is pretty good
if an FWSE can use it, so can you
com.google.guava didn't give it away?
I wasn't sure if google used the libraries that they provide for the public in their own systems.
why would they create them then lol
they use guava in particular extensively
what do you think about calling methods from a constructor @fleet crane
Idk
does anybody know a plugin that autosells everything that is dropped from a farm in a chunk? like a chesthopper
How do i sort players by money and deaths on playerlistplus
Tried asking the one who created it?
Not sure with the plugin, but in java, you can sort players by values using TreeMap
PacketPlayOutWorldParticles
has like 7 parameters i think
Not sure if you need to use abstraction/reflection when using over more versions
Though in the newer versions, you can just use World#spawnParticle
would that work in 1.8?
no I think
sad
just use packets huh?
yeah nobody does particles with packets to be honest
since we have a good API for them
The api is only in newer versions @sturdy oar
and that's why you should update
no its really not
what if some people use older versions if they have a pvp server for example?
and they need particles?
Well in my opinion I've never supported <1.13 because it's just retarted
And the spawnParticle thingy only works on the API version
arent all spigot versions retarded
I hope we'll see only the latest versions only in the future