#help-development
1 messages ยท Page 8 of 1
connection.prepareStatement("SELECT playerId FROM Hsmp.stats WHERE playerId = '3c7fe390-3f61-4078-a8ea-b6ea302ea00b'");
if I'd just run that, wouldn't it work?
it should, don't see anything wrong with that query except you might want to change from single quotes to double quotes on the end
okay ๐
it should work as is, I just don't understand your code where you are trying to make use of stringbuilder and that odd loop
which is what is most likely breaking everything ๐
also, you need to have a try catch block too, to catch any SQLExceptions thrown
thats fine, just didn't see it in the code you presented was all
๐
Is it possible to get who threw a damage potion when the entity gets hit with it with EntityDamageEvent?
how would i use BlockMask? This returns 0 because theres no baseblock but how would i make a baseblock? I couldn't find anything on google about it
Mask mask = new BlockMask();
int amountblocks = editSession.countBlocks(region, mask);```
I can know the name of the api you are using?
Im interested on it
worldedit
Oh ok
Yeah same thing
2 Things
- Send the whole class so we can match the error to the line next time.
- You check the length of the array then you never return so it does the next check anyways. And an else or return.
mike you know anything about worldedit api?
because i wanna finish this soon
get it over with
public static String getPermanentHealth(Player player) {
return String.valueOf(player.getAttribute(Attribute.GENERIC_MAX_HEALTH));
}
this is wrong?
Did you read what I said? I said next time you're sending a class send the whole class. The issue you're having is that you're getting the error because you don't check if the array length is zero before accessing it
yeah thanks. It fixed that problem, but now it gives me the value of Util.getPermanentHealth(player) but in form of org.bukkit.craftbukkit.v1_19_R1.attribute.CraftAttributeInstance@525af5ee
What does get attribute return?
Gives me that message ingame. I try to return the string value of a players generic max health attribute but I dont know how to convert it to int in a string
of course
?
Is there any way to make a firework live forever? I can currently set the power to 127 via the meta, which makes the life of the firework 64 seconds. Is there a way to increase the time even more?
you could just check which item it is
alternatively you can check if the item is an instance of Damageable
if it is, then it has durability and can take damage
it wouldn't work if you are using outdated versions
but if you do indeed have a valid item from the inventory, then you can do an instance check on that
the instance check will be true for items like you are wanting, false otherwise
declaration: package: org.bukkit.inventory.meta, interface: Damageable
Why does my callback not add all the data to my chunks list even though I know there is data?
private static final List<Chunk> chunks = new ArrayList<>();
@Override
public void generate() {
ChunksScanner.getChunksWithMostEntities(1, chunks::addAll);
}```
or
private static final List<Chunk> chunks = new ArrayList<>();
@Override
public void generate() {
ChunksScanner.getChunksWithMostEntities(1, result -> chunks.addAll(result));
}```
same thing
never mind its an args problem
lambda โน๏ธ
so its adding some of the data?
or none at all
no its my getchunkswithmostentities method
forgot to pass the worlds lol
so it just did nothing
big brain
pog
yay I cant format for shit
lol
Hey guys! So I think there's a problem with ChatColor.valueOf(). I am using <version>1.19-R0.1-SNAPSHOT</version> and for some reason no matter what string I put into this it won't return anything whatsoever.
Just to confirm there are NO whitespace in my string and I am doing colour names such as WHITE in full caps as requested, but it won't send anything
- What import are you using?
- How are you calling it?
Cause, I'm using ChatColor#of() just fine on 1.19
Code:
Bukkit.broadcastMessage("Suffix: " + metaData.getSuffix());
Bukkit.broadcastMessage("Saved Colour 1: " + AllianceTagFile.fileConfig.getString("Alliances." + alliancename + ".Colour"));
Bukkit.broadcastMessage("Saved Colour 2:" + ChatColor.valueOf(AllianceTagFile.fileConfig.getString("Alliances." + alliancename + ".Colour")));
Bukkit.broadcastMessage("Boolean: " + metaData.getSuffix().equalsIgnoreCase(ChatColor.WHITE + " | " + ChatColor.valueOf(oldchatColor) + alliancename));
Result:
[02:05:49] [Server thread/INFO]: Suffix: | Lol
[02:05:49] [Server thread/INFO]: Saved Colour 1: RED
[02:05:49] [Server thread/INFO]: Saved Colour 2:
[02:05:49] [Server thread/INFO]: Boolean: false
- import org.bukkit.ChatColor;
- Not sure what you mean by this
It just won't return anything whatsoever with ChatColor.valueOf(), it's so weird
Could it be because I'm using 1.19 API on a 1.18.2 Server?
Possibly, but ChatColor#valueOf() should work the same. The only difference that could possibly be is the transition from an enum class to the normal class setup.
This would most likely be your problem. Generally plugins compiled for higher versions simply won't work for lower versions
Gonna go try on 1.19 now
Do mc players enjoy skyblock or factions more?
Also, it looks like the old enum methods like #name, #ordinal, #valueOf, etc are all deprecated in 1.19. Not sure if there are going to be replacement methods, but I'd recommend changing your setup to use ChatColor#of() instead of ChatColor#valueOf().
Will try this now, as changing to 1.19 didn't work
Can't see that? Unless I need to use the Bungee API ChatColor
Yep, gotta use that one for that specific method. However, I just realized that you are dealing with normal chat colors. ChatColor#translateAlternateColorCodes() should be enough unless you have hex color codes. In which case, you will have to import the net.md_5.bungee.api.ChatColor class instead of the org.bukkit.ChatColor class.
translateAlternateColorCodes() only translates characters like '&' though right? I'm checking for capitalised words like: RED, WHITE, BLUE
It needs a character, yes. You can't translate names
It does, (it can technically be whatever character you want, but the standard is &), but you could make your own conversion layer if you need the names.
Any specific reason as to why that's the case? Wouldn't it be possible to have a #valueOf method or is that covered by another method that I'm unaware of?
Because it's a legacy method to translate legacy colour codes
If you want to replace strings, "<green>Hello world".replace("<green>", ChatColor.GREEN.toString());
Alright waduhek... so the ChatColor.valueOf() thing is working, but it doesn't print anything out? I'm honestly so confused...
Cause it changed my Colour with no problems whatsoever, but won't print it in chat
I'm just doing Bukkit.broadcastMessage()
Because #toString() of a ChatColor is just the legacy format code
If you're printing that out on its own, it's going to be an empty message
That's because the symbol is automatically converted to the one minecraft uses to display colors. It won't show up in the game chat if it's proceded by a color char.
Ahhh
Are we allowed to ask questions about NMS here?
Yes, but you may not get much help as many people here only have certain experience with specific parts of NMS.
Okay, my question is:
Is there a method ran every tick in the nms Entity or the nms EntityLiving in 1.18.2?
Hi, How can I detect triggers?
Triggers?
Not sure myself, but I wouldn't be surprised if there was. I have seen discussions about methods being ran near constantly on certain things using NMS.
those who use datapacks
Did you add the SpecialSource plugin to your pom.xml?
wym
He's using 1.8
oh
baseTick()
Okay, thanks
There's actually tick(), baseTick(), and postTick()
Though tick(), by default, just calls baseTick()
Either way, call the super method first before doing anything if you intend on overriding lol
wat dat
also hi choco
it's for 1.17+, sorry
Yeah dw
anyone :quack:
I think hypixel did something weird with patterns
but it was natively so like
player.sendMessage("%%red%%You do not have permission!") would automatically parse colors
I wonder if it's possible to do that without modifying outbound packets or spigot itself
they use their own server.jar, that's probably how they did it
yeah I know they do
I wonder if they just wrapped the player object and just overwrote the #sendMessage() method.
it's native
no wrapping
Makes sense. Would be the smarter approach. lol
found it in a twitter post
So, when it comes to formatting color codes, is there supposed to be a standard way to do it? Because, it seems that every plugin uses the legacy color code system. I thought that was just because people don't want to type out ChatColor.COLOR + ANOTHER COLOR + etc... every time they want to send a message.
Now that the class has changed from an enum, things will probably have to be adjusted in some plugins.
It's still an enum. BungeeChat's ChatColor is a class though
Though the replacement for legacy chat is text components. So Bungee Chat is its replacement
Paper makes use of Adventure
For the record, the ChatColor enum (and BungeeChat's ChatColor class) are also legacy formats
Well is there an easy way to work with text components then? Cause when it comes to complex color strings, it's a little easier to just type out your short color codes rather than creating several text components, setting the color, and repeating for every character that has/needs a different color. Hex color codes are also another hurdle.
I'd like to use the modern standards, but the legacy ones are easier to work with atm.
you need to intercept the outbound packet or create a patch for sendMessage
the only way
It's easier, yes, but no there's no better way to do it
If you're working with Paper's Adventure library, MiniMessage is provided so you can actually parse it out with the tags like I mentioned above
BungeeChat doesn't have an equivalent, however
honestly yeah, if you are making your messages configurable (highly recommend) then minimessage is the best choice
gives users all of that freedom
(without reinventing the wheel to support complex texts)
The second one will always be true
|| should be an &&
Depends on what you're doing though. If you're checking for right clicking air, there are some items that just don't tell the server about that anymore. Exception to things like fishing rods, but if you right click air with a sword or an empty fist or something, the client doesn't send a packet
also, please change the .equals() to an ==
you can use == on enums, it's guaranteed to only have 1 instance
Hey so I have a list of items in my config. I need to load and grab one of the items based off their chance. Currently trying this but its grabbing the same item every time
public RewardItem getRandomReward() {
//Define a sum variable that we change with each loop
int currentSum = 0;
Random random = new Random();
for(RewardItem rewardItem : getRewardItems()) {
int rewardChance = rewardItem.getChance() / 100;
int randChance = random.nextInt(0, 1);
currentSum = currentSum + rewardChance;
if(currentSum >= randChance) {
return rewardItem;
}
}
return null;
}
hive-rewards:
1:
type: gold_nugget
name: '&6Golden Nugget'
amount: 1
chance: 25
lore:
- '&eA golden nugget... how original.'
2:
type: gold_nugget
name: '&6Golden Nugget 2'
amount: 1
chance: 25
lore:
- '&eA golden nugget... how original.'
could I suggest a much more beautiful configuration instead
hive-rewards:
- type: gold_nugget
name: '&6Golden Nugget'
amount: 1
chance: 25
lore:
- '&eA golden nugget... how original.'
- type: gold_nugget
name: '&6Golden Nugget 2'
amount: 1
chance: 25
lore:
- '&eA golden nugget... how original.'
how is it a problem?
because then if a user wants to insert something in the middle of their reward list, for organization, then they need to change every number downwards to look right
must think of the user experience !
yea... ok fair but then how would i get "type"
getList and cast to a List<ConfigurationSection>
ideally i wanted to use gson for this but i cant cause thats hard to edit in configs
well you can use configurate if you want the pojo -> yml serialization
this whole "chance to get item" thing is confusing to me
I need some help. I suck at Java but I want to make the riptide tridents in the way they work in MCC. Basically you can hold down right click and it auto launches the trident with no collision (adds velocity and plays the sound) anybody know if there is a way to check if a trident is fully charged? Cause if they let go before its fully charged I dont want it to launch them.
in any case, this is some old code for doing this basically
im pretty sure it's because getting a random number won't include the upper bound
the chances do not need to add up to anything, it's x/(total chance)
so random.nextInt(0,1) would always return 0
yea thats how I want it
why would it always be 0?
should be 0 - 1
because getting a random number is exclusive
as in
if you get a random double
it'll be between 0 and 0.9999999...
it would never be 1
Map<HiveReward, Integer> chances = ...;
int total = chances.values().stream().mapToInt(Integer::intValue).sum();
int count = random.nextInt(total) + 1;
while (count > 0) {
for (HiveReward reward : chances.keySet()) {
count -= chances.get(drop);
if (count <= 0) return drop;
}
}
that's what I had (adapted to your purpose)
but yes, datasianboi is correct
slightly confusing
nextInt(0, 1) will always be 0
the upper bound is exclusive, the lower bound is inclusive
so i need 0-100 then instead
so it's anything up to that number, which for a number without decimals is 0
idk am not a debugger
Ah yes, truncation doing its work here.
that part makes sense now
don't we just love floating point numbers </3
well you could just make the upper bound 2
so it would pick a random number between 0 and 1
You could also try random weighted selections if you don't want to deal with chance.
^ that too
It doesn't look like it. At least to me.
Perhaps I'm just confusing the term
when I hear of chance I think /100, then a weighted selection would be x/total
which is his end goal
Hmm, maybe I'm also being pedantic with semantics, but from what he shared, it looked like he was doing something different with his math. Maybe I just read it wrong, but using weights would be easier than trying to calculate numbers totaling up to 100.
ah yeah I have no clue what the code was doing
public RewardItem getRandomReward() {
//Define a sum variable that we change with each loop
int currentSum = 0;
Random random = new Random();
for(RewardItem rewardItem : getRewardItems()) {
int rewardChance = rewardItem.getChance();
int randChance = random.nextInt(0, 100);
currentSum = currentSum + rewardChance;
if(currentSum >= randChance) {
return rewardItem;
}
}
return null;
}
Alright well now its giving me null items
I just know looking at the config he's taking a random reward with a chance, but the total of the chances is not guaranteed to add up to 100
correct
well, gotta make a function out of it
the chances are stored in the RewardItem object btw
I need some help. I suck at Java but I want to make the riptide tridents in the way they work in MCC. Basically you can hold down right click and it auto launches the trident with no collision (adds velocity and plays the sound) anybody know if there is a way to check if a trident is fully charged? Cause if they let go before its fully charged I dont want it to launch them.
Riptide tridents can only be charged if the player is in water, or the area they are standing in is raining, and they aren't in one of the "hot" biomes. Otherwise, if you want them to work anywhere and everywhere, you'll have to delve in to NMS for a manual call to the riptide effect.
public RewardItem getRandomReward() {
//Define a sum variable that we change with each loop
Map<RewardItem, Integer> chances = new HashMap<>();
Random random = new Random();
for(RewardItem rewardItem : getRewardItems()) {
chances.put(rewardItem, rewardItem.getChance());
}
int total = chances.values().stream().mapToInt(Integer::intValue).sum();
int count = random.nextInt(total) + 1;
while (count > 0) {
for (RewardItem reward : chances.keySet()) {
count -= chances.get(reward);
if (count <= 0) return reward;
}
}
return null;
}
Alright here's my current setup. Pretty sure I just need to add the chances for each item to the map and such beforehand (edited above)
my intention is for them to only work in the water, but I'm trying to remove riptide collision whilst also making them automatic
Are you wanting null items as a possibility? Or do you want to always give an item out to the player?
It always needs to give something
I also have a class for this, but you would need to modify your code to work with it.
?paste
Some of this is new to me so im kinda lost a lil bit hold on..
never used NavigatableMap
or RandomCollection
For usage, it would be something like this.
RandomCollection<HiveReward> rc = new RandomCollection<HiveReward>()
.add(80, new HiveReward(1))
.add(35, new HiveReward(2))
.add(25, new HiveReward(3));
for (int i = 0; i < 10; i++) {
System.out.println(rc.next().getI());
}
RandomCollection is a custom class.
Guessing the 80, 35, 25 are the chances
Yep
should be able to do this in a loop right?
You could pass in your chance variable instead.
I guess more specifically, they are the weights. (Higher weights means higher chance to get that reward)
But, yes. You could easily do this in a loop.
what is "E"
"E" is one of the Generic types you can use.
ah..
alright so I dont wanna go changing my whole class structure here so to adapt that...
Generics are a little bit of a complex topic, but once you figure out how they work, they are really great. https://www.tutorialspoint.com/java/java_generics.htm
You shouldn't need to change much of your class to adapt that new class.
So can I keep my getRandomReward function? the part you sent seems like its making a new instance of the entire class with parameters
Oh..
just put that into ur project and then use the class with generics, you only need the generics in that 1 spot
exactly as shown here
Alright so literally copy paste
Adapting your code to use the RandomCollection class wouldn't be that hard.
List<HiveReward> rewardList = new ArrayList<>();
rewardList.add(new HiveReward(35, "Gold Ingot"));
rewardList.add(new HiveReward(25, "Iron Ingot"));
rewardList.add(new HiveReward(10, "Diamond"));
RandomCollection<HiveReward> rc = new RandomCollection<>();
for (HiveReward reward : rewardList) {
rc.add(reward.getWeight(), reward);
}
for (int i = 0; i < 10; i++) {
System.out.println(rc.next().getReward());
}
You already have a way to get your list of reward items, so you would just need to adapt this code to fit your needs.
Sry, wrong output.
public RewardItem getRandomReward() {
//Define a sum variable that we change with each loop
RandomCollection<RewardItem> rc = new RandomCollection<RewardItem>();
for(RewardItem rewardItem : getRewardItems()) {
rc.add(rewardItem.getChance(), rewardItem);
}
for (int i = 0; i < 10; i++) {
System.out.println(rc.next().getI());
}
}
What's getI?
I was throwing classes together real quick for example purposes. It represents the weight. So you're more than welcome to change the method names to something sensible.
well I want to return my entire RewardItem object
so
for (int i = 0; i < 10; i++) {
System.out.println(rc.next());
}
?
Then just return RandomCollection#next() and cast it to the proper object.
public RewardItem getRandomReward() {
//Define a sum variable that we change with each loopd
RandomCollection<RewardItem> rc = new RandomCollection<RewardItem>();
for(RewardItem rewardItem : getRewardItems()) {
rc.add(rewardItem.getChance(), rewardItem);
}
for (int i = 0; i < 10; i++) {
System.out.println(rc.next());
return rc.next();
}
return null;
}
alright
well
i dont need the for i loop do i
Probably not.
Only wanna return one item
That was just there to show what the output would be like if you were doing multiple rolls.
As long as that RandomCollection isn't empty, it'll return something.
public RewardItem getRandomReward() {
//Define a sum variable that we change with each loopd
RandomCollection<RewardItem> rc = new RandomCollection<RewardItem>();
for(RewardItem rewardItem : getRewardItems()) {
rc.add(rewardItem.getChance(), rewardItem);
}
return rc.next();
}
looks good to me I think
IT WORKS
LETS GOOO I LOVE U
yes homo
โค๏ธ
got both items now
mm thatt structure that just prays on garbage collection
what
Lol, true, but it shouldn't be a big issue if the lists are kept small. Even lists of 1000 reward items wouldn't be that big of an issue.
pre-cache the list
Fair enough.
It'll never be anywhere even near 1000
The items are stored in a config already
and are loaded from it
Yea, but when the method is called, it creates the object again. So instead, you could have that list stored outside the method and just update it on startup/reload and you'll only create it once.
The RandomCollection? @kind hatch
Yes.
bet, ez
private RandomCollection rc;
public RewardItem getRandomReward() {
if(rc == null) {
rc = new RandomCollection();
for(RewardItem rewardItem : getRewardItems()) {
rc.add(rewardItem.getChance(), rewardItem);
}
}
return (RewardItem) rc.next();
}
WAIWT
Not quite.
there
Still not what he was getting at.
The goal is to not create the list object in the method.
well with this way it would only make it the first time its called
But to instead access an already existing list.
1 sec and I'll show you what it should look like.
ok
@carmine nacelle https://paste.md-5.net/azezejiyiw.cs
This is an example of how this would look. I obviously made this in a normal java context, but I think you can get the idea from it.
ah right right, that does the same thing just in different places
ill use that tho
thx guys
Now back to the idea of changing my confg layout around..
hive-rewards:
- type: gold_nugget
name: '&6Golden Nugget'
amount: 1
chance: 25
lore:
- '&eA golden nugget... how original.'
- type: gold_nugget
name: '&6Golden Nugget 2'
amount: 1
chance: 25
lore:
- '&eA golden nugget... how original.'
id now getstringlist
ConfigurationSection section = hiveRewardsConfig.getConfigurationSection("hive-rewards");
section.getKeys(false).forEach(reward -> {
String itemType = section.getString(reward);
String itemName = section.getString(reward + ".name");
});
Am I on the right track there...?
itemType would be "item" on the top level, then name would be the "name"
does WorldGuard Region Events have a dependency, if so where?
java.lang.NullPointerException: Cannot invoke "org.bukkit.configuration.ConfigurationSection.getKeys(boolean)" because "section" is null
at com.squallz.cadiabees.managers.configmanagers.HiveRewardsConfigManager.loadHiveRewardsConfig(HiveRewardsConfigManager.java:41) ~[?:?]
bruhhh why is my "hive-rewards" no longer considered a configurationsection?
its pretty outdated.. last updated 2016
damn
i just need the on region exit
isnt that part of the regular api
tysm
i couldn't find it for like an hour :/
it was in the comments of the original
ahhh
i never checked there
also if i do this will it automatically save?
wg api ^
no idea havent used it in a while
i dont think so
damn
@drowsy helm do you know anything about my above question
Probably a formatting issue. Check your spacing.
hmmmmm..
yeah i think that just means the key is missing
- type: gold_nugget
- name: '&6Golden Nugget'
amount: 1
chance: 25
lore:
- '&eA golden nugget... how original.'
does every line need a dash?
No, only the first one.
which is line 41
ConfigurationSection section = hiveRewardsConfig.getConfigurationSection("hive-rewards"); this?
section.getKeys(false).forEach(reward -> {
section.getKeys(false).forEach(reward -> {
String itemType = section.getString(reward);
String itemName = section.getString(reward + ".name");
int itemAmount = section.getInt(reward + ".amount");
int itemChance = section.getInt(reward + ".chance");
List<String> itemLore = section.getStringList(reward + ".lore");
some stuff after it
oh section is null
yeah
why isnt it throwing an npe though
idk why the section is null it shouldnt be
interesting
it is
oh mb
lmao
[00:36:19] [Server thread/ERROR]: Error occurred while enabling CadiaBees v${project.version} (Is it up to date?)
java.lang.NullPointerException: Cannot invoke "org.bukkit.configuration.ConfigurationSection.getKeys(boolean)" because "section" is null
at com.squallz.cadiabees.managers.configmanagers.HiveRewardsConfigManager.loadHiveRewardsConfig(HiveRewardsConfigManager.java:41) ~[?:?]
at com.squallz.cadiabees.CadiaBees.onEnable(CadiaBees.java:50) ~[?:?]
at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:264) ~[spigot-api-1.19-R0.1-SNAPSHOT.jar:?]
at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:342) ~[spigot-api-1.19-R0.1-SNAPSHOT.jar:?]
at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:479) ~[spigot-api-1.19-R0.1-SNAPSHOT.jar:?]
at org.bukkit.craftbukkit.v1_19_R1.CraftServer.enablePlugin(CraftServer.java:523) ~[spigot-1.19-R0.1-SNAPSHOT.jar:3545-Spigot-475f600-4230f8f]
at org.bukkit.craftbukkit.v1_19_R1.CraftServer.enablePlugins(CraftServer.java:437) ~[spigot-1.19-R0.1-SNAPSHOT.jar:3545-Spigot-475f600-4230f8f]
at org.bukkit.craftbukkit.v1_19_R1.CraftServer.reload(CraftServer.java:922) ~[spigot-1.19-R0.1-SNAPSHOT.jar:3545-Spigot-475f600-4230f8f]
at org.bukkit.Bukkit.reload(Bukkit.java:801) ~[spigot-api-1.19-R0.1-SNAPSHOT.jar:?]
at org.bukkit.command.defaults.ReloadCommand.execute(ReloadCommand.java:27) ~[spigot-api-1.19-R0.1-SNAPSHOT.jar:?]
at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:149) ~[spigot-api-1.19-R0.1-SNAPSHOT.jar:?]
at org.bukkit.craftbukkit.v1_19_R1.CraftServer.dispatchCommand(CraftServer.java:831) ~[spigot-1.19-R0.1-SNAPSHOT.jar:3545-Spigot-475f600-4230f8f]
at org.bukkit.craftbukkit.v1_19_R1.CraftServer.dispatchServerCommand(CraftServer.java:816) ~[spigot-1.19-R0.1-SNAPSHOT.jar:3545-Spigot-475f600-4230f8f]
at net.minecraft.server.dedicated.DedicatedServer.bg(DedicatedServer.java:419) ~[spigot-1.19-R0.1-SNAPSHOT.jar:3545-Spigot-475f600-4230f8f]
at net.minecraft.server.dedicated.DedicatedServer.b(DedicatedServer.java:395) ~[spigot-1.19-R0.1-SNAPSHOT.jar:3545-Spigot-475f600-4230f8f]
at net.minecraft.server.MinecraftServer.a(MinecraftServer.java:1197) ~[spigot-1.19-R0.1-SNAPSHOT.jar:3545-Spigot-475f600-4230f8f]
at net.minecraft.server.MinecraftServer.v(MinecraftServer.java:1010) ~[spigot-1.19-R0.1-SNAPSHOT.jar:3545-Spigot-475f600-4230f8f]
at net.minecraft.server.MinecraftServer.lambda$0(MinecraftServer.java:291) ~[spigot-1.19-R0.1-SNAPSHOT.jar:3545-Spigot-475f600-4230f8f]
at java.lang.Thread.run(Thread.java:833) [?:?]
is ConfigurationSection section = hiveRewardsConfig.getConfigurationSection("hive-rewards"); initialized correctly?
initialized?
like set up correctly
try just put a string in your yaml and get it
not in a section or anything
this was working before I changed the yml format and tried to adapt this to work
1s
how would i fix this?
hive-rewards:
1:
type: gold_nugget
name: '&6Golden Nugget'
amount: 1
chance: 25
lore:
- '&eA golden nugget... how original.'
2:
type: gold_nugget
name: '&6Golden Nugget 2'
amount: 1
chance: 25
lore:
- '&eA golden nugget... how original.'
my old layout
new
hive-rewards:
- type: gold_nugget
name: '&6Golden Nugget'
amount: 1
chance: 25
lore:
- '&eA golden nugget... how original.'
- type: gold_nugget
name: '&6Golden Nugget 2'
amount: 1
chance: 25
lore:
- '&eA golden nugget... how original.'
trying to make it more user friendly
yeah
String itemType = section.getString(reward); wouldnt you do .type?
i dont use yaml much so im not too familiar tbh
well since its the top/main line i didnt think so..but maybe?
im just throwing out ideas lol im probs wrong
C:\Users\josh9\IdeaProjects\EmbarkkCore\target\classes (Access is denied)``` help lmao
is that with mavne?
yeah
dependency:
<dependency>
<groupId>com.github.NetzkroneHD</groupId>
<artifactId>WGRegionEvents</artifactId>
<version>1.7.3</version>
</dependency>```
its fine
i mean i do, but i can download the plugin
m2?
mvn clean
does clean delete it aswell?
not sure
yeah do that then
that means i gotta redownload them all
fastasyncworldedit takes like 10 minutes for no apparent reason
probably shitty repo
probably xD
wait that error is when you compile right
hey since you suggested this, how can I loop through all that?
dont shade it i reckon
isnt it just an api
ye its also a plugin
i implemented the plugin into my server
should fix the problems
hopefully
hm
it seems like the event isn't working at all now
it creates it but whenever i go over the threshold it doesn't activate the event
public class RegionExit implements Listener {
@EventHandler
public void onRegionExit(RegionLeaveEvent e) {
Bukkit.broadcastMessage(e.getRegion().toString());
}
}```
surely you could just make your own event
is sqrt laggy in java?
nah
never noticed that before
ye
should i just make my own bounds system then?
store them in like bounds.json or something
idek waht this is for tbh
would still have to get the wg regions
well its just for private mines. So players can't go over the bound. I would use barriers but people hack yk so i'd rather cancel the event. And plus it looks more professional
ik its sorta reinventing the wheel but when i was working on my rpg i just made my own region and anti grief system
way more control over stuff
yeah i was debating if i should just make my own bounds system for what i need it for
theres pros and cons about both so
yeah it was reasons like this that i did
they just forget stuff in api
so you have to do stupid work arounds
:/
so lost on this
Anyone know why im not able to loop over this
hive-rewards:
- type: gold_nugget
name: '&6Golden Nugget'
amount: 1
chance: 25
lore:
- '&eA golden nugget... how original.'
- type: gold_nugget
name: '&6Golden Nugget 2'
amount: 1
chance: 25
lore:
- '&eA golden nugget... how original.'
ConfigurationSection section = hiveRewardsConfig.getConfigurationSection("hive-rewards");
section.getKeys(false).forEach(reward -> {
"section" is not a valid configurationsection
tis tis tis
List<ConfigurationSection> sections = (List<ConfigurationSection>) hiveRewardsConfig.getList("hive-rewards");
@carmine nacelle ^
hmmm
but I cant use getString
@compact haven
oh I might actually be stupid
probably
List<ConfigurationSection> sections = (List<ConfigurationSection>) hiveRewardsConfig.getList("hive-rewards");
for(ConfigurationSection section : sections) {
java.lang.ClassCastException: class java.util.LinkedHashMap cannot be cast to class org.bukkit.configuration.ConfigurationSection (java.util.LinkedHashMap is in module java.base of loader 'bootstrap'; org.bukkit.configuration.ConfigurationSection is in unnamed module of loader java.net.URLClassLoader @18769467)
at com.squallz.cadiabees.managers.configmanagers.HiveRewardsConfigManager.loadHiveRewardsConfig(HiveRewardsConfi
REEE
any other suggestions then
?paste
why is this giving error https://paste.md-5.net/ximupewufo.php
java.lang.RuntimeException: java.util.ConcurrentModificationException```
ur changing the value of something while iterating over it.
it gives u a stack trace no..?
nvm fixed it
i used a if redstone is being restored and then stopped anything else
big brain
so i basically need to get a list of configurationsections then loop over each one..
Just out of curiosity is it possible to tell if a player is looking at a entity/block
Iโm assuming yes, by checking the pitch and other associated values
I believe you can raytrace it
How do I know when the server has fully started up?
like all plugins are loaded and all worlds are loaded?
is there an easy way?
or do I need to loop through all the plugins and check?
Yes, 1sec
because my plugin is messing up peoples servers at boot
Either check the current tick, or the phase ^
Can I copy and paste this?
Sure
Schedule a task in your onEnable
The task scheduler doesnโt start processing until startup is finished
I am doing that
as so
new BukkitRunnable() {
@Override
public void run() {
Logger.info("Server finished starting, registering performance optimisers");
plugin.getServer().getPluginManager().registerEvents(new HaltServer(), plugin);
plugin.getServer().getPluginManager().registerEvents(new LagPrevention(), plugin);
new HeartBeat().start();
if (!(getLagNotifierData().getRunInterval() < 1)) {
new LagChecker().start();
}
}
}.runTaskLater(NeoPerformance.getInstance(), 1L);```
but it isn't really doing it
Why are you doing @override ? just do run() in onEnable
Yes because run() is not a standard thing
Wait why are you registering stuff in a thread when you could run it in enable?
registering listeners a tick after...
it would be acceptable if you wanted to wait for the worlds to load
so it is
but even then just load those sensitive classes then
im trying to create two configurations.
25.07 07:12:49 [Server] ERROR java.io.FileNotFoundException: plugins/MultyBot/bans.yml (No such file or directory) 25.07 07:12:49 [Server] ERROR at java.io.FileInputStream.open0(Native Method) 25.07 07:12:49 [Server] ERROR at java.io.FileInputStream.open(FileInputStream.java:195) 25.07 07:12:49 [Server] ERROR at java.io.FileInputStream.<init>(FileInputStream.java:138) 25.07 07:12:49 [Server] ERROR at net.md_5.bungee.config.YamlConfiguration.load(YamlConfiguration.java:77) 25.07 07:12:49 [Server] ERROR at net.md_5.bungee.config.YamlConfiguration.load(YamlConfiguration.java:71) 25.07 07:12:49 [Server] ERROR at MultyBot.Main.onEnable(Main.java:40) 25.07 07:12:49 [Server] ERROR at net.md_5.bungee.api.plugin.PluginManager.enablePlugins(PluginManager.java:315) 25.07 07:12:49 [Server] ERROR at net.md_5.bungee.BungeeCord.start(BungeeCord.java:290) 25.07 07:12:49 [Server] ERROR at net.md_5.bungee.BungeeCordLauncher.main(BungeeCordLauncher.java:67) 25.07 07:12:49 [Server] ERROR at net.md_5.bungee.Bootstrap.main(Bootstrap.java:15)
also calling a singleton on the main class ..?
The KISS method of programming.
Code
?paste
it's a bungee plugin
you notice that immediately by the way the configs are loaded
and also the stacktrace
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
did you even bother to read his code
I have read it but i didnt saw that its was bungee
so do I do this?
public void registerOptimizers() {
//Register ability listeners
if (ServerUtils.getLifePhase() == ServerUtils.ServerLifePhase.RUNNING) {
Logger.info("Server finished starting, registering performance optimisers");
getServer().getPluginManager().registerEvents(new HaltServer(), this);
getServer().getPluginManager().registerEvents(new LagPrevention(), this);
new HeartBeat().start();
if (!(getLagNotifierData().getRunInterval() < 1)) {
new LagChecker().start();
}
}
}```
do I need a run later?
if its not loaded?
Why cant you just register your listeners โright nowโ?
because they detect if the server is lagging
Then just wait a tick to register them
What could be the cause of this problem? I went to sleep yesterday and still am in bed. I can get you the code only in like 7 mins
I was, but someone using it was still having double with it
What problem?
return; problem solved
bro tf
intellij just set my project to a paper plugin
not a spigot plugin and broke half the plugin
Paper has more events tho
anyway how to fix dis
lol
you mean this weird "Minecraft development" plugin?
That's the worst intellij plugin ever
mhm
Pom.xml
what does it even do?
crashes
And google โSpigot dependencyโ
it does nothing useful and always only causes problems
i have it doe
Well then you have it
is there any "paper" thing left in your pom?
whut? you dont need paper for worldedit
then it lied to me
I use worldedit API frequently and I always only use spigot, never paper
its because paper is lighter thus spends less resources on WE
๐ถ
also, why do you have spigot 1.17 but paper 1.19? o0
dont ask..
i have my ways
lol
lol ok
Sigh.
I love my Burchard's constructor
show code
you have a "zero width space" somewhere
the full error should tell you the location
hey mfnalex
if (ServerUtils.getLifePhase() != ServerUtils.ServerLifePhase.RUNNING) {
return false;
}```
Is that okay if I run that every second?
because its in my is server halted method
true for halted false for not
bro now im getting this
tf is happening
everything is self destructing on me ๐
Did you copy paste someones code?
Dump it through a https://www.nousphere.net/cleanspecial.php or something
A quick and easy free tool to remove special characters from Word cut and pastes. For use when pasting to your blog, article, sales page, or email newsletter.
yeah that wont work
You tried it?
yeah
only whitespace content allowed before start tag and not \u0 (position: START_DOCUMENT seen \u0... @1:1) pom.xml
any idea?
I'd copy the contents somewhere, delete the original, then remake it.
it's a 2m venture
sure
you have an invisible whitespace or similar at the beginning of your pom
not that im aware of
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>```
i haven't even touched it. idk what's going on
If you remake it then that should fix it. If it doesn't you most definitely need to strip special characters cause you have a problem with one
yeah
ig i'll do that
probably the easiest way of fixing the error
weird
okay so
i copied a pom.xml from another project of mine
and edited it for the current project
and its still the same
spigot mappings are so weird, lmao.
on NTTagCompound, it's setString, getString, setInt, getInt, etc, but for a long[] its called getLongArray and a()
lmao
Unusuable
the whole <?xml tag
i've literally copied from another pom.xml without the error
remove the whole first line
do i not need it?
yes, all others are so ugly lol
you also have weird stuff in your main class then, lol
like what doe
\ufeff is an invisible white space
and how would i fix that
do ctrl+r, then enter \ufeff to replace, and nothing as replacement
no idea if replace works for unicode, though
na, it doesn't
are you on linux?
hm
do you got git bash?
sed $'s/[^[:print:]\t]//g' file.txt
this removes all "weird" characters from file.txt
no, but i can download it
drop the file in here
Is there a list somewhere of all the Java APIs that are shaded into the Spigot JAR by default? (e.g. mysql-connector, yaml, etc.)
no
but you can just open the .jar and check the libraries folder
Oh yeah, thanks.
i've had no problem with this until i reopened intellij
Try that
odd, its fine in Eclipse
well
try sending the whole file instead of copy pasting it
I bet that eclipse will then be angry
he did
discord probably strips stuff like invisible whitespace
no, its copy paste
he sent the whole file
you can see that because it's callef "message.txt"
it is copy paste, not the actual file
ah
try that
well I sent back after reformatting and he says it still bad
Works just fine in Evlipse
have you tried to run sed @quaint mantle ?
na
^
one moment
zero errors or warnings
problems like these are the worst, lol
man
hello! i have a problem with BuildTools, so...
I had installed java 8, 16 and 17 versions before, and i want to build 1.19 via BuildTools, but it choose only java 16, how to choose 17?
give the full path to java, e.g.
/c/Program\ Files/Java/jdk-18.0.0/bin/java.exe -jar BuildTools.jar --rev 1.19 --remapped
tq im going to try that
invalidate caches and restart
I usually use a bunch of aliases in .bash_aliases so I can just do java18, java17, java11, ...
thanks, thats work perfectly!
I think I havent written any code myself since I got github copilot lol
it's basically only "pressing tab" since then lmao
i think i cant write somewhat really useful but im trying
what does it do
everything
it suggests code
and in 99% of cases its exactly what you wanted to write
yikes, I only got 4 GB of LTE left and my current phone invoice is already at 177 โฌ o0
is it worth the money?
Is there any good alternative to reusing noteblock states for cusotm blocks that won't eventually end up running out of space for textures?
thought you were speaking about my fucking useless mobile phone contract lmao
copilot is so absolutely worth it!!!! for real
no
there are mainly 3 ways:
- noteblock blockstates
- mushroom block blockstates
- armorstands with heads
yeah idk how good mushroom is and armour stands are just gonna get laggy
IIRC mushroom blocks are better than noteblocks because you dont have to cancel any events, but they have less blockstates to use. and armorstands are laggy
i will give it a try then
if its not worth it
you scammed me
i'll try that
I swear it's worth it
copilot seems cool
wtf
corrupted world?
nah it's a new one. I only tried to save some NBT data to an entity and then everything died lmao
what happens if you run "mvn package" anyway?
does intelliJ itself show anything about that file?
have you tried the "sed" thing?
"Error loading plugin Mainlobby" What my going to do
?notworking
"Does not working" is a useless statement. Please describe what exactly is not working, what you expect it to do, and what actually happens. If you get any console errors, also ?paste the entire stacktrace.
?paste
@hybrid spoke you got any other ideas on how i can fix this? ( illegal character: '\ufeff' )
you could try to just make a new file
Modifying mobs
yeah ig
can i ask a question? i need to get net.minecraft.server.v1_19.ItemStack, but i cant get ItemStack, cuz with v1_19 its not exist, so... how to did that
The package names now match vanilla
?
does anyone know why my whole server dies whenever I load a CompoundTag into an entity? :X
it's called net.minecraft.world.item.ItemStack
fix it. that's all we can say if you don't send the full stacktrace
Okay
(
But my in bungeecord server there is no logs folder
You're using unmapped. The method name will be a(), b() etc..
wtf is NBTTagCompound? Are you using obfuscated / spigot mappings? o0 because the class is just called CompoundTag in the proper mappings
Yeah Spigot mappings
FFS use mojang mappings lol
?help
selfrole Add or remove a selfrole from yourself.
cleanup Base command for deleting messages.
embedset Commands for toggling embeds on or off.
info Shows info about CafeBabe.
licenseinfo Get info about Red's licenses.
mydata Commands which interact with the data CafeBabe has about...
set Commands for changing CafeBabe's settings.
uptime Shows CafeBabe's uptime.
findcog Find which cog a command comes from.
names Show previous names and nicknames of a member.
userinfo Show information about a member.
listcases List cases for the specified member.
reason Specify a reason for a modlog case.
permissions Command permission management tools.
?paste
What is the best website for new Java developers?
Wtf
you need an IDE
You need an ide, you can't really write
xD
use your text editor
Is there anyway to make it so that an inherited method must call the super method?
notepad
it's the best IDE 100000%
for what
just call what you need before using the inherited method anywhere
wdym?
?learnjava
Here are some links to get you started on learning Java:
- https://www.codecademy.com/learn/learn-java
- https://www.sololearn.com/learning/1068
- https://www.learnjavaonline.org/
- https://programmingbydoing.com/
- https://docs.oracle.com/javase/tutorial/java/index.html
The last one is the only official one, however some of those concepts assume that you already know a bit about programming.
Ty
well, at some point you need to invoke the method they just implemented and if you really need to execute something right before, just call it
no. the inherited method would have to call super() itself
well it gets called by a listener
it's a bit weird
basically the inherited method is the method executed by the listener, but I want additional code to be ran before the listener method.
so the obvious solution would be to make a new method which is inherited, then have the listener method not inherited, run the extra code then call the inherited method

however I don't think this would due to either type erasure or annotations not being inherited
lol
I'll just show the code
Love this emote
there are kinda two ways to use this class, it's strange, ignore the second constructor
and why dont you just invoke whatever you need before you call onEvent?
I don't call onEvent
it's a listener
it triggers when an in game event happens
the best thing I can think of is to have a higher priority event which runs the code and cancels the event
then in the inherited methods check if the event has been cancelled or not
you do call onEvent
as i can see in your constructor
this is a very weird design anyways
I reinstall ny server
yes I know lmao
how would you suggest?
depends on what you are trying to do
What I was meaning by that
I use it like this
What would you do?
basically I'm making a bunch of map editing tools for different minigames
that code is going to appear in all the tools
or very similar
it can be abstracted
I don't really want to copy and paste that every time
or I might forget one time to do it
so then it could be at best not consistent and at worst dangerous
Just don't use it 
I don't
I am just bored and so i decided to add some NBT stuff to my lib
turns out that NBT is even shittier than I thought though, lol
doesn't even save custom tags
Smh almost like there is a spigot API to save custom stuff
can someone help me
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. Make sure you use the right channel regarding the topic of your question. Create a thread in case the channel is already in use!
well im trying to make the warden stronger but I have no idea how to modify the warden, im not sure if there is like an event or something but what im trying to do is to make it immune to explosions/potions
Well you can listen to entity damage event
Is anyone familiar with guice and providers?
Unfortunately, many plugins still use NTB and I sometimes need to read those tags
For potions iirc there is a potion effect applied event
Please open a thread for this. If I have to read a conversation about guice, I probably have to vomit
maybe something have idea place radius block?
Why do you say that?
Because guice is a huge pile of shit
Is it tho?
and shit is disgusting and so I gotta vomit, lol
What else do you suggest using?
None of those weird workarounds, just properly provide instances to stuff you need yourself
DI frameworks 
@Command(label = CommandLabel.ACCEPT)
public class AcceptCommand implements CommandInterface {
@Inject
private CitizenService citizenService;
@Inject
private InvitationService invitationService;
@Inject
private SettlementService settlementService;
@Override
public void run(Player player, String[] strings) {
if (strings.length == 2) {
String string = strings[1];
if (!invitationService.hasNoInvitation(player, string)) {
player.sendMessage(Remote.prefix(Locale.INVITATION_NULL, string));
return;
}
Settlement settlement = settlementService.getSettlement(string);
if (settlement == null) {
player.sendMessage(Remote.prefix(Locale.SETTLEMENT_NULL, string));
return;
}
player.sendMessage(Remote.prefix(Locale.SETTLEMENT_JOIN, string));
invitationService.removeInvitation(player, string);
citizenService.add(player, settlement);
}
}
}
``` Literally have it working nicely and setup how I want it
I just wanted to know if anyone knows about providers...
ugh
But fine guess I am not going to ask here cause of salty responses like yours
Have a good day
thanks
Well tbf I told you in the beginning that I think that guice is a joke, soooo
also asked you to use a thread and you just ignored that, so what did you expect lol
Couldn't you just look at their wiki o.o
I am sure that you will get a proper response if you actually open a thread
Guice is pretty well documented
also what is your actual question?
because if you don't rephrase it, my current answer would be "yes" and that's probably not very helpful
didnt we have a command for this
?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. Make sure you use the right channel regarding the topic of your question. Create a thread in case the channel is already in use!
I didn't find any solution so I'm looking for the specific error in catch (duplicate key 'PRIMARY') and then just update instead of insert ๐
is there an event for when the palyer stops breaking a block or do i have to make a packet listener
bro
we are living in awesome times
1.19 has EVERYTHING
declaration: package: org.bukkit.event.block, class: BlockDamageAbortEvent
idk lol. I googled the BlockDamageEvent and then it was listed at "See also"
how to get no permission message from paper.yml?
can't you just load the file as YamlConfiguration?
ddoesnt SKULL_ITEM exsist in 1.16
wtf is SKULL_ITEM
maybe there are other way?
not when usign spigot api
well if you're talking about player heads, they are simply called PLAYER_HEAD
both, the placed block, and the inventory item
First, I check if the target is null. Then trying to check if the first argument is a player. then trying to get /command add <player>
dont know how, me new
Honestly I couldn't care less
I don't want your advice lol
how to get server platform like paper/spigot/bukkit?
Take this to #help-server but for the record, there are tons of good tutorials
on youtube
Maybe they wanna fetch it programmatically from their plugin
or just use SMPCore and let it load that config for ya, because yes
but the message just sends higher numbers than 5
like the initial message is you've been muted for 5 seconds
and then if they type again
it becomes like you're still muted for 16 seconds
etc
if (original - (current - max) > 0) return;
removeMute(player)
try something similar to that
can you send a link to tutorial pls, i didn't find anything
ty
will checking is command /paper exists work?
I did it there
ok
what?
oh you wanna check if the server is running paper?
just Class.forName some paper-only class
e.g. com.destroystokyo.paper.ParticleBuilder
BHAHAHHAHAA
PARTICLE BUILDER
jesus
them jokes are nice
public static boolean isPaper() {
try {
Class.forName("com.destroystokyo.paper.ParticleBuilder");
return true;
} catch (Throwable t) {
returnn false;
}
}
what's wrong with that?
why?
what's wrong with having a normal builder for particles lol
it's useless
It certainly is not
isn't it just new Particle(type, data)
but you do you, noonne forces you to use a ParticleBuilder lol
one liners shouldn't be made into builders
will this work?
if (sender.getServer().getPluginCommand("spigot") == null){
// command not exists
}
no
I will unalive me
ok thanks
how about checking the server software version?
also what are you trying to achieve with that?
what aren't they trying to do
Oneliners that would stretch over your screen and even beyond that
those should
or just
you know
new lines exist
what's so big to do with particles
I think a builder for that is very useful
genuinely tell me
Receivers, source, particle type, offsets etc
it's really kinda messy
someone good with itemsadder here ?
?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. Make sure you use the right channel regarding the topic of your question. Create a thread in case the channel is already in use!
if you quickly look away from a block and back and start breaking BlockDamageEvent doesnt even get called lol