#help-archived
1 messages · Page 170 of 1
oh
Yeah I'd bet you that a . is a special character, Tanku
so then how would I get a dyecolor from a color, if there's no mapping?
You don't. Where did that byte colour come from?
When I made the command add quotes, it wrapped itself in single quotes
but I can't add single quotes as it will then wrap it in double single quotes
and when I don't add single quotes it is just a normal string without single quotes
Also I've tried it with the permission minecraft, same thing
public class TeamColor {
String prefixColor;
String teamName;
Color color;
int colorID;
public TeamColor(String prefixColor, String teamName, Color color, int colorID) {
this.prefixColor = prefixColor;
this.teamName = teamName;
this.color = color;
this.colorID = colorID;
}
public Color getColor() {
return this.color;
}
public String getChatColor() {
return this.prefixColor;
}
public byte getByteColor() {
return (byte)this.colorID;
}
public int getIntColor() {
return this.colorID;
}
public String getTeamName() {
return this.teamName;
}
}
I have a colorID if that's useful
So now the main question is:
If it needs single quotes why in the world won't it let me add them
int colorID
Replace that int with a DyeColor 🙂
Whenever you construct a TeamColor, pass instead a DyeColor rather than an integer
(the getIntColor() can be deleted too as it serves the same purpose as getByteColor())
I had remembered a method similar to that but wasn't sure if it still existed. Yeah, you could. Though it might be better to just pass a DyeColor through the constructor anyways
That method has to do a bit of math to get a good estimate of what DyeColor best represents it
The problem I'm having lies within this:
List<String> list = usersConfig.getStringList(uuid + ".permissions");
list.add(name);
I don't know what is happening man it reads it as an empty list although the list ain't empty and the path is correct
Should I read it as something else?
public DyeColor getDyeColor() {
return DyeColor.getByColor(this.color);
}```
Orrrr, again, just pass one in through the constructor lol
does this look like that should work?
Or at least get that DyeColor from the constructor. Whatever
well I could, but I think that might have a lot of usages to change
you shouldn't be doing debugging on a live servers anyway
@tiny dagger I tried it, and movecraft works fine on the separate server.
Well that int parameter from the constructor is gonna have to get removed anyways
As it won't be used
Hello people, Earlier today i asked a few questions but couldnt continue sadly (Thanks to 7smile7 and arcaniax for trying to help me!), We couldnt figure out how we broke TNT duping but now we want to rewind to vanilla from spigot until we find a long term solution. Sadly when we tried our nether dimension (and potentially the end dimension) reset, any idea's how we can rewind to vanilla without reseting them?
oh
it has only one other usage
ConfigurationSection section = conf.getConfigurationSection("Teams");
if (section != null) {
for(int i = 0; i < section.getKeys(false).size(); ++i) {
String start = "Teams.Team" + (i + 1);
String prefixColor = conf.getString(start + ".ColorPrefx").replaceAll("&", "§");
String teamName = conf.getString(start + ".ColorName");
Color color = Color.fromRGB(conf.getInt(start + ".Color.r"), conf.getInt(start + ".Color.g"), conf.getInt(start + ".Color.b"));
int colorID = conf.getInt(start + ".BlockColorID");
TeamColor teamColor = new TeamColor(prefixColor, teamName, color, colorID);
teamColors.add(teamColor);
}
}```
Should i post my problem anywhere else to not clog up this chat?
hmm
quick question, would it even be possible to degrade from spigot to vanilla without reseting the nether and the end?
why would you use vanilla server?
that's in paper.yml
well we broke tnt duping...
this is not Paper discord, go there if you're using that
well then I don't think you can change it
Did anybody ever use this?
JavaPlugin.getPlugin(Main.class)
i always used dependency injection
yeah keep using it, nothing wrong with it
it gets hard to track after some time
Entity != EntityType
Hey snoopy, if ur not busy rn could i ask you a few quick questions on DM?
being?
I am kind of confused by what you meant when you said "If you have paper"
Paper is a fork of Spigot
Is there a way i can know ingame if a server is Paper?
wut...
It will say when you run /version
I thought you're running the server...?
This isn't exactly the paper discord
Oh, sorry
also i did use the /version now, yes we are on paper
ill go find the paper discord
Thank you for your time!
@mellow wave how would I do it then?
Not too hard, event.getRightClicked().getType() == EntityType.VILLAGER
huh
well...
What do I do with the DyeColor now to get a terracotta material with the color?
I think Choco said Map<DyeColor, Material>, but how do I use that?
I want to create a plugin that will display the title to the player when I log in.
Please let me know if you know.
I know.
@scenic hound Learn java
@scenic hound It's more than anyone can answer in a discord message
Use an online tutorial or the oracle docs
A fundamental knowledge of java will help you make good, efficient, quality plugins.
Not exactly being rude
That's the truth
It would be rude if I said "Use an online tutorial, asshole"
You dont need to be explicit in order to be rude. And the Answer you gave was not exactly polite.
@scenic hound You basically need an instance of your object you want to reach in an acessible scope.
Thats the answer.
But you might look into java
hey can someone explain why this has happened? 😄
theyve all frozen in place
they wont eat, or move or anything, i assume theyre inactive but how do i fix it
Do you have any plugins that freeze mobs under heavy load
I still dunno how to get a Material from a block name and a DyeColor...
@desert kraken is your TPS ok?
yeah, been at 20 for past 12 hours or so
Yeah I belive that might be the cause but it's not supposed to do it when the player is close
tick duration isnt long either
Material from a name would be
Material.valueOf(name)
huh?
@stoic shell What exactly do you need?
i found the paper discord server, thanks everyone!
I have a DyeColor, and I need a terracotta Material of the color.
Material.valueOf(dye.toString().replace("_DYE", "_GLAZED_TERRACOTTA"))
Or use a Map<Material, Material> pref EnumMap
- Create a new EnumMap<Materia, Material>(Material.class)
- Fill it with key->dye value->terracotta
nvm...
oh wait
I found this: block.setType(Material.getMaterial(dyeColor.name() + "_TERRACOTTA"));
would this work fine?
And second, my IDE says this, is this an actual concern?
Yes its a valid concern. No, it wont work.
Wai´t
Hm it might work.
Why not just create a static Map ? Its way faster than using some String stuff.
it is possible that the block you are getting from the location can be air @stoic shell
which is equivalent to being null
Thats not what the warning is about
but the author didn't have anything about that before I changed this to use a DyeColor
Material.getMaterial might be null
well if it compiles, I'll leave it for now at this point 👀
but it doesn't compile... I'm getting complaints of... duplicate variables?
public static final Map<DyeColor, Material> COLOR_TO_TERRACOTTA = new ImmutableMap.Builder()
.put(DyeColor.BLACK, Material.BLACK_TERRACOTTA)
.put(DyeColor.RED, Material.RED_TERRACOTTA)
// etc. - do this for all dye colours
.build();
// somewhere else
Material redTerracotta = COLOR_TO_TERRACOTTA.get(DyeColor.RED);```
Throws an exception if not present
well then I have to do that for all the dye colors...?
Ah yeah I guess null is better than an exception
eh alright, I'll get back to it after I get this done
private static final EnumMap<DyeColor, Material> DYE_TO_TERRACOTTA = new EnumMap<>(DyeColor.class);
static {
for (final DyeColor color : DyeColor.values()) {
try {
final Material terraMat = Material.valueOf(color.name() + "_TERRACOTTA");
DYE_TO_TERRACOTTA.put(color, terraMat);
} catch (final Exception ignored) {}
}
}
Please don't use string manip like that
Those dye colours aren't guaranteed to be 1:1
Not sure.
If the format is always
<Color>_TERRACOTTA and matches the values of DyeColor then yes.
Otherwise you would need to manually fill the map
Yes. You just call DYE_TO_TERRACOTTA.get(color) and it returns the material or null if its not in the map
Still heavily advise against that method
Just write in the mapped values manually
It's more readable and you can easily pick out errors. Typo TERACOTTA and you're going to spend hours figuring out why it won't work. Or maybe TERRACOTTA will change in the future but you won't ever know because you have a String value
then maybe I just don't ignore the exception, instead print out something?
Or...
Just write in the mapped values manually
I'm not sure why you're all so insistent on not doing that
Its not that many
got to love it when people ignore the recommended ways
You can also choose the ImmutableMap approach with a wrapped EnumMap
Maps.immutableEnumMap()
how can I get a user rank with vault or without
Of what plugin?
The Rank plugin im using is LuckPerms
I dont... understand that sentence
there
Ranks aren't wrapped by Vault
alright, moving on
Permissions, economy and chat are
To my knowledge, those aren't exposed by Vault. Though maybe I'm wrong
Choco what part Canada you from?
Well you have issues like these which are easily resolvable:
incompatible types: int cannot be converted to DyeColor
TeamColor teamColor = new TeamColor("&f", "Not setUp yet", Color.WHITE, 0);```
Change that 0 to DyeColor.WHITE
I'm in Southern Ontario
k, lemme fix those first
That's quite possible, though it also explains names like var15
Cool, Im in north of Ontario
You'll end up with a lot of oddities because decompiled code obviously isn't 1:1 with source
so, should I be using their api to get the player's rank?
and it unfroze, now I can fix that...
you can use vault to get ranks if ranks are based on permissions
alright I fixed that
they are based on weight
then obviously vault isn't going to work for that 😛
oh no
froze again?...
did ya make a method for it?
remember when I replaced int with dye?
yea
ah
well now I need an int, cause it was used somewhere else
the complete line in question is:
ItemStack it = GeneralMethods.CreateItem(ChatColor.DARK_PURPLE.toString() + (i + 1) + ". team", GeneralMethods.arrayToList(new String[]{teamColor.getChatColor() + teamColor.getTeamName()}), Material.TERRACOTTA, teamColor.getDyeColor());
but it needs an int apparently...
oh look at that
CreateItem in GeneralMethods uses a deprecated method
How can we modernize this?
public static ItemStack CreateItem(String name, List<String> loreList, Material material, int data) {
ItemStack item = new ItemStack(material, 1, (byte)data);
ItemMeta meta = item.getItemMeta();
if (!name.equalsIgnoreCase("")) {
meta.setDisplayName(name);
meta.setLore(loreList);
} else {
meta.setDisplayName(ChatColor.BOLD + " ");
}
meta.addItemFlags(new ItemFlag[]{ItemFlag.HIDE_ATTRIBUTES});
meta.addItemFlags(new ItemFlag[]{ItemFlag.HIDE_POTION_EFFECTS});
item.setItemMeta(meta);
return item;
}```
ItemStack Deprecated, and uses data
Can just remove the data from that all together
Pass in the Material instead
Well, rather, you already have a Material lol
huh...
The data argument. There is no data in 1.13. They're all separate materials
oh yeah
So instead of passing Material.TERRACOTTA, you'd pass the material you fetch from the Map like you did last time
then it conflicts with the below method
which is:
public static ItemStack CreateItem(String name, List<String> loreList, String url) {
ItemStack head = new ItemStack(Material.PLAYER_HEAD, 1);
if (url.isEmpty()) {
return head;
} else {
SkullMeta headMeta = (SkullMeta)head.getItemMeta();
GameProfile profile = new GameProfile(UUID.randomUUID(), (String)null);
profile.getProperties().put("textures", new Property("textures", Base64Coder.encodeString("{textures:{SKIN:{url:\"" + url + "\"}}}")));
try {
Field profileField = headMeta.getClass().getDeclaredField("profile");
profileField.setAccessible(true);
profileField.set(headMeta, profile);
} catch (IllegalArgumentException | IllegalAccessException | NoSuchFieldException var8) {
var8.printStackTrace();
}
if (!name.equalsIgnoreCase("")) {
headMeta.setDisplayName(name);
headMeta.setLore(loreList);
} else {
headMeta.setDisplayName(ChatColor.BOLD + " ");
}
headMeta.addItemFlags(new ItemFlag[]{ItemFlag.HIDE_ATTRIBUTES});
headMeta.addItemFlags(new ItemFlag[]{ItemFlag.HIDE_POTION_EFFECTS});
head.setItemMeta(headMeta);
return head;
}
}```
oh
nvm
that's the method above it lol
so I can just get rid of that method altogether, since the method above is the same without data
Yep
and then another 2 above that are the same scenario, I removed one
oh
What color is data 8 on stained glass pane...
light grey I found
fixing issues of the same nature...
ok so I think its actually based permissions
This is why we were happy with 1.13 lol
because im look at lp doc and this is one of their examples
public static String getPlayerGroup(Player player, Collection<String> possibleGroups) {
for (String group : possibleGroups) {
if (player.hasPermission("group." + group)) {
return group;
}
}
return null;
}
Is this the channel for problems I have?
yes
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.
oh dang
ok well I have a spigot server and I wanted to allow my friends to join it, so I followed the instructions on the wiki
I fixed the ones I saw, tried to build again (expecting build failed) and I got build failed of course.
But the thing it tells you to download requires Java 9, which you cant download
So is there another way?
eh
I already tried just port forwarding
you got java 9?
then download java 8
It doesnt work with it
yea it does
could even use Java 14
broski wym you can't download it https://www.oracle.com/java/java9.html
yes
Oh ok
how does this work ```java
public static String getPlayerGroup(Player player, Collection<String> possibleGroups) {
for (String group : possibleGroups) {
if (player.hasPermission("group." + group)) {
return group;
}
}
return null;
}
oh neat
I found that DYE_TO_TERRACOTTA very useful 🙂
I put it in it's own util class since I realized that's gonna be needed again later, and it was
also, I've got while loop replaceable with enchanced for ALOT
Just correct them?
I bet it's due to decompilation.
What have you decompiled
Oh then it's normal to have weird stuff after decompilation
My eyes. They burn.
Haven't you ever looked at mojang's decompiled code
var1 and var2 here.
currently fixing the one below that, changing stained glass data 8 => light gray stained glass
alright, here we have:
private void OpenPlayMenu(Player player) {
Inventory inv = Bukkit.createInventory(null, 45, this.saves.menuTitle);
inv.setItem(10, GeneralMethods.CreateItem(this.saves.playButtons.get(0).title, this.saves.playButtons.get(0).lore, this.saves.buttonMaterial, this.saves.buttonData));
inv.setItem(12, GeneralMethods.CreateItem(this.saves.playButtons.get(1).title, this.saves.playButtons.get(1).lore, this.saves.buttonMaterial, this.saves.buttonData));
inv.setItem(28, GeneralMethods.CreateItem(this.saves.playButtons.get(2).title, this.saves.playButtons.get(2).lore, this.saves.buttonMaterial, this.saves.buttonData));
inv.setItem(30, GeneralMethods.CreateItem(this.saves.playButtons.get(3).title, this.saves.playButtons.get(3).lore, this.saves.buttonMaterial, this.saves.buttonData));
inv.setItem(14, GeneralMethods.CreateItem(this.saves.playButtons.get(4).title, this.saves.playButtons.get(4).lore, this.saves.buttonMaterial, this.saves.buttonData));
inv.setItem(16, GeneralMethods.CreateItem(this.saves.playButtons.get(5).title, this.saves.playButtons.get(5).lore, this.saves.buttonMaterial, this.saves.buttonData));
inv.setItem(32, GeneralMethods.CreateItem(this.saves.playButtons.get(6).title, this.saves.playButtons.get(6).lore, this.saves.buttonMaterial, this.saves.buttonData));
inv.setItem(34, GeneralMethods.CreateItem(this.saves.playButtons.get(7).title, this.saves.playButtons.get(7).lore, this.saves.buttonMaterial, this.saves.buttonData));
for (int i = 0; i < 45; ++i) {
if (i != 10 && i != 12 && i != 28 && i != 30 && i != 14 && i != 16 && i != 32 && i != 34) {
inv.setItem(i, GeneralMethods.CreateItem("", null, Material.LIGHT_GRAY_STAINED_GLASS_PANE));
}
}
player.openInventory(inv);
}```
I can't download java because it costs money aparently
omg whats that attrocity
You probably just need to find the archive page.
so now...
I have a link
I need that button data in the material
You're probably looking at the Oracle page
Dude no don't install Oracle stuff
wtf, they removed java 8 from that.
Oh
cause I've removed the data constructor as there is no data in modern versions
PLEASE USE THIS JDK
https://adoptopenjdk.net/
I have an oracle account coz I found it rly annoying trying to find the DL pages.
So now how am I gonna get that "buttonData" in the buttonMaterial?
O, what's the benefit of not using oracle?
Adopt was acquired by Eclipse Foundation recently as well iirc
So not a massive corporate entity that's trying to control the internet space.
It's an open source implementation of the Java platform. Oracle's licensing changes are a bit more limiting so a lot of people jumped to OpenJDK instead
AdoptOpenJDK is primarily just a set of open source scripts that builds OpenJDK and distributes binaries for you
Though really, as far as the average user should be concerned, it's Java
Personally, I use AdoptOpenJDK.
lol
but any thoughts on my problem?
sorry, was trying to replace the many iterator and while loops with enhanced for, lol
public int buttonData;
this.buttonData = conf.getInt("Menu.Item.Data");
So it's configurable. Though again, there's no data. Can be deleted
Item:
Material: STAINED_CLAY
Data: 1```
so first, that should be terracotta....
then I can just remove Data and ButtonData and I'll be fine?
Yep
You'd have to update the material in the config to the appropriate value though
(because stained clay doesn't exist obviously)
yeah I just did
Then you're good to go
well I'm still removing data and button data
oh wait
I would also change terracotta to ORANGE_TERRACOTTA, since that's what data 1 was for stained clay
Will I be notified when my premium resource is approved/denied? (or will I need to check on the page every once in a while to see)
Sorry if this is answered somewhere else, I've looked through all the docs I could find and saw nothing on how I'd be notified on any approval updates.
I got java and beacon still wont work
Does it not work anymore?
I actually don't remember if you're notified when approved. You'll be notified if it's rejected, that's for sure.
Does beacon still work?
OK, thanks. I guess I'll keep checking every once in a while then lol
I have the right Java version and its still mad at me
alright, now I am fixing some more data value usages that showed up
This is confusing me how am I suppose use this ```java
public static String getPlayerGroup(Player player, Collection<String> possibleGroups) {
for (String group : possibleGroups) {
if (player.hasPermission("group." + group)) {
return group;
}
}
return null;
}
Use vault API preferably
alright...
Hm
@lone fog do i need to use maven with vault?
You don't need to
Ok
I've got 2 data value/int usage errors, 1 material name error, and 7 duplicate variable errors.
What is another way of allowing my friends to join my world, because Beacon isnt working
Im gonna need help with vault api permission thing
oh wait, before I get to that, I noticed a possible bug
if (game.state.equals(TheBridge.GameState.Playing) && e.getBlock().getType().equals(Material.TERRACOTTA) && this.IsInsideTheBuildBorder(e.getBlock().getLocation(), game)) {
Will this catch all colors of terracotta?
No because TERRACOTTA doesn't exist
wat
You know when u join a server u get like a second of invulnerability? Would there be any way to disable it if that be with a plugin. because people on my server are abusing it like crazy.
lol
oh there's just regular terracotta, you're right
Well, no, that wouldn't cover them all. You'd have to create an EnumSet constant of all the types of terracotta and check against that instead
private static final Set<Material> TERRACOTTA_BLOCKS = EnumSet.of(Material.RED_TERRACOTTA, /* yes, this again */);
TERRACOTTA_BLOCKS.contains(block.getType())
.-.
There's no vanilla Tag for it you can refer to unfortunately so you have to make your own lol
well, I've got code for the DYE_TO_TERRACOTTA, which used code that did something like that
😠
Pretty much the same thing only you're creating another constant and it's a Set instead of a Map
(because you don't need those DyeColor mappings)
Does vault have a support discord?
a:
b:
- c
- d
ab:
In this situation, how would I check if b exists? Supposedly it doesn't register as a ConfigurationSection, I assume due to the variables underneath
I've tried both
config.getConfigurationSection("a").isConfigurationSection("b")
config.isConfigurationSection("a.b")
Both return false.
b would be considered a list
Then is there a way I can check whether or not it is there?
I believe there is a contains method
declaration: package: org.bukkit.configuration, interface: ConfigurationSection
i mean, upon going there i found isList was a thing, so I'd assume that could work
isList method documentation: "If the path exists but is not a List, this will return false. If the path does not exist, this will return false. If the path does not exist but a default value has been specified, this will check if that default value is a List and return appropriately."
😄 I may have got the Set done right
Interestingly enough it worked at first with isList, then once the list was added to, it was no longer recognized as a list
Any way to disable spawn invulnerability when you join the server?
@subtle blade Is this right?
public static final Set<Material> TerracottaColorSet = new EnumSet<>;
static {
for (final DyeColor color : DyeColor.values()) {
try {
final Material terraMaterial = Material.valueOf(color.name() + "_TERRACOTTA");
TerracottaColorSet.add(terraMaterial);
} catch (final Exception error) {
Bukkit.getLogger().info("Error forming TerracottaColorSet:");
error.printStackTrace();
}
}
}```
Oh wait no, my ide says no to new EnumSet<>;
public static final Set<Material> TerracottaColorSet = EnumSet.noneOf(Material.class);
static {
for (final DyeColor color : DyeColor.values()) {
try {
final Material terraMaterial = Material.valueOf(color.name() + "_TERRACOTTA");
TerracottaColorSet.add(terraMaterial);
} catch (final Exception error) {
Bukkit.getLogger().info("Error forming TerracottaColorSet:");
error.printStackTrace();
}
}
}```
This should fix it
Is it possible for a citizens npc to place blocks when its stuck? im guessing no since in Dreams way he used a hacked client to make an AI that hunts you down like a player. (cant say the name for obvious reasons.)
Dream made a plugin that allows a player to move on its own or hunt you down, he used a hacked client so it can place blocks on its own without controlling it if u didnt know wtf terminator im talking about.
Also i know the terminator wasnt an npc, a player. Just wanna do a replica
Alright, used it and it seems to work, moving on
So here's an interesting problem.
For context, I have a command that allows me to add an item to a list in a YamlConfiguration. I also have a command to remove an item from the list.
Upon reload, I can add an item to the list, and there is now an item in the list. If I add another, it instead replaces the item rather than adding. Although, if I reload and then add another item, it will add another just as I wanted.
If I reload and remove the item, the entire section of the list will delete, as wanted. Though, if I don't reload and remove the item, only what's inside the list will delete, leaving me with list: [] rather than null, or nothing, just like I want.
So, TL;DR, I can not do edit my list more than once without reloading between each edit. Is there anything I can do to work around this? I have a method to reload the configuration file, and I do that after every edit as well, although it doesn't work as wished for.
If needed, here is the part that matters of my class: https://hastebin.com/ifuximuwug.js
Although, I'm not sure it will help since I don't think it has to do with my code... although it may, I have no idea. I just think it's reload being wonky.
now I'm fixing the duplicate variables...
it looks like someone went through and half-of-the-time removed String when making string variables, and used msg1 for different things consecutively
Maybe if anyone knows what part of the server needs to be reloaded for my commands to... well, work? That way I could at least try to figure out a way to individually reload that part.
for me, idk
I'll make a post on the forums since I don't want this to get lsot
@tiny pebble You should not write the item directly in the file.
On runtime you use a List<ItemStack> on shutdown you save the list to a yml file on enable you load the list from the
yml again and from there on use the given List for further manipulation until the next shutdown
I have it written directly into the file as I want the users to be able to edit the permissions through the configuration file as well as through commands.
Should I have it go through a medium of some sort?
What permissions? You wanted to maintain a List of ItemStacks right?
List of strings 😛
I specified "item" just meaning... anything
was just a placeholder
sorry bout that miscommunication
Ah ok.
whats the best packet armorstand API out there, I want one where I can set the item in hand, teleport, and have multiple lines
I don't want to use holographic displays because it has many extra things that I don't need for my project
Can I have some help aka therapy to fix my sleep schedule?
That's not what this discord is for
Oh
lol
@flat topaz Listen to an audiobook in darkness. Thats what i do to get tired.
Ok I’ll try it lol
@tiny pebble Holy this code is literally unreadable...
hahaha yeah i figured.. i'm only 4 months into coding. it's understandable for me but i know that it's very disorganized and could be put together much better
its a whole mess and i'm sorry for that haha
6 more errors to go...
i could post the whole class although i doubt that'll make anything better..
that is one of the many known rookie mistakes indeed
alright...
i planned on keeping it like that then ending up fixing it once it gets actually working
that is why i hesitated showing my code at all lol
i doubt it really helps
Nah my code also looked like this in the first two weeks.
well i've only been coding since quarantine and haven't done all too much with it. also completely self-taught lol
although my dad works with this stuff so he offered to help me get it organized and provide feedback on what i did that was gross
I'm assuming the old Material.LONG_GRASS is now Material.TALL_GRASS. Am I right?
My recommendation is that you first embrace the concept of early exit
eg
if(args.length <= 2){
// message
return
}
i was debating that, although i want it to send many different messages to specify the problem the command had
5 errors now. Getting close.
You can still do that.
You can keep exactly the same functionality as now but way more readable.
ah okay, i'll reorganize it as such then in the morning ahha
you think i should ask the forums? probably after i reorganize it haha
ask about?
@grim halo just tagging you since you're the one that looked at it, curious about your input about me posting it. sorry for the ping
4 errors.
i think he's just screwing with ya
tanku what are you going to post about
3 errors
just return early like 7smile said
the problem isn't my organization, the problem is this https://discordapp.com/channels/690411863766466590/690470011382267904/731289289190670467
yes I am just messing with you @stoic shell
my organization i'll fix later 😅
however one day you will encounter that scenario where you think you have a small amount of errors left
and then you change something and voila 10 more errors just popped up XD
lol
The solution is you load the list from yaml
So does anyone have a recommendation for a packet armorstand API ?
and store it memory and maniulate it, and save it when you need to
dont directly edit the yaml list
oh lol
just 2 errors
1 is just a simple variable name fix
second I'll need help with
@quartz trench How exactly would I go about loading the list from the yaml..? I honestly thought that's what I was getting it lmfao
1 error!
@tiny pebble I see you are still on the same problem lmao
😄
it's the weirdest problem i have ever encountered, yes
personally I would just store it as a string in yaml separated with ,
alright so now, the last problem
thats another way to approach it
i might have to resort to that, yeah
@EventHandler
void onBuild(BlockPlaceEvent event) {
Player player = event.getPlayer();
if (this.main.playersInGames.containsKey(player.getName())) {
Game game = (Game)this.main.gamesList.get(this.main.playersInGames.get(player.getName()));
event.setCancelled(true);
if (game.state.equals(TheBridge.GameState.Playing) && !this.blackListedBlocks.contains(event.getBlock().getType()) && event.getBlock().getType().equals(Material.TERRACOTTA) && this.IsInsideTheBuildBorder(event.getBlock().getLocation(), game)) {
ItemStack item = event.getItemInHand();
if (item != null) {
player.getInventory().setItem(player.getInventory().getHeldItemSlot(), GeneralMethods.CreateItem(Material.TERRACOTTA, 64, item.getData().getData()));
}
event.setCancelled(false);
}
}
}```
The line of focus is
player.getInventory().setItem(player.getInventory().getHeldItemSlot(), GeneralMethods.CreateItem(Material.TERRACOTTA, 64, item.getData().getData()));
or just addAll the getStringList from yaml to a list, clear it on reload, and if its empty on save then save null instead of empty list
How do I put that data in the Material, since there isn't Data anymore?
ah i see
thank you so much @quartz trench , my brain has been fried for a concerning amount of time because i didn't know how yaml's worked lmao
this is just the same as the rest of the terracotta with data => terracotta material with color I think
Snoopy I recommend not using hashmaps like that, make a user class that stores all your data, then put those in just one hashmap
having collections that big is probably not good on your performance
if (this.main.playersInGames.containsKey(player.getName())) {
have a hashmap of users
and do
oh
user.isInGame()
this isn't my original plugin
my concern right now is getting it to compile first :p
lol
Do you know how I can put that data in the material?
or get the color from the item somehow?
I usually do 1.8 so if its a higher version i wouldnt know
what version snoopy
I think you need to do material.toString and check it for a color name yourself
if it is on 1.8 you could use an enummap of byte as key and a custom Color enum as a value
and to get the colored material use Material.of("color" + Material.terracotta)
then the color value would be in item.getType().name()
or material.toString() for terracotta, wool, etc
for dyed armor and stuff its different
it would be like
IRON_BARS
or smth
so you replace the name of the matieral
and then it will give the color
not sure, test it. but getType returns Material and I think .getName() on Material is the same as toString()
and yeah do what iron man says. .getType().toString().replace("TERRACOTTA", "") and then you have color
nvm
all I needed was that .getType.name()
that's really what I was needing
and...
ugh
1 more error popped up.
Fixed.
YAY!
lol
alright, lemme put this in my plugins...
and starting...
bruh
java.lang.IllegalArgumentException: No enum constant org.bukkit.Material.BED
I know exactly the problem, lol.
I forgot to change BED in the config to RED_BED
Oh look, I fixed that and it started and enabled successfully! 🎉
[19:56:27 INFO]: [TheBridge] Enabling TheBridge v1.0.0
[19:56:27 INFO]: [TheBridge] Your server is running version v1_16_R1
[19:56:27 INFO]: [TheBridge] Plugin enabled!```
@quartz trench Curious, is what you told me to do the same as:
List<String> list = config.getStringList(path);
list.add(var);
config.set(path, var);
???
If not that's fine, just asking since that's what I did prior. Though I've edited it a tad
Well, that took all day...
so whats up with player#getOpenInventory(); ? it always returns the same thing lol
you sure?
it may return the same OpenInventory class or whatever but its contents are most likely different
Ive used it in the past
you must be checking the wrong player, or its async and may not be updated perfectly
@tiny pebble it's not really the same try ```java
//field in config class
private final List<String> list = new ArrayList<>();
//in your reload/load config method
list.clear();
list.addAll(config.getStringList(path));
//in your save method
config.set(path, list);
ahhh okay
@marsh hawk are you storing the reference of the inventory ?
if so, you need to update the reference otherwise you will only get the same inventory
oh thats interesting
Does anybody know a better plugin loader/unloader than AutoPluginLoader? It crashed my server when I tried unloading a plugin, and PlugMan is outdated.
@quartz trench
list.clear();
list.addAll(usersConfig.getStringList(uuid + ".permissions"));
list.add(name);
usersConfig.set(uuid + ".permissions", list);
usersConfig.save(Main.getInstance().getUsersConfigFile());
I've tried something like this and have ended with the same result I kept getting: it replaces the list with the new value rather than adding to the list with the new value.
I know you said to put it in my reload config function, though I'm unable to as I require a UUID from the user from the command event.
@wet bronze there's this, https://www.spigotmc.org/resources/serverutils-bungeecord-spigot-manage-plugins-in-game-more.79599/
@quick arch Will that let me unload plugins seamlessly? Because there's a plugin on my server screwing with Movecraft and I can't keep restarting my server to see which plugin it is because it takes 10 minutes for it to start up.
no idea, haven't tried it yet
Pluginmanager and similar stuff breaks a lot of plugins
would not reccomend tbh
restart the server fully when changing plugins
I've tried making a separate server on my PC to debug so it doesn't affect my players but the plugin decides to work on that server with the exact same plugins and folders.
The only plugins/folders I don't copy are the dynamic map and towny ones because they're fucking huge and if they're what's screwing with movecraft, I can't get rid of them since they're essential to the server.
public void end() {
for (EnvoyDrop drop : envoyDrops) {
world.getBlockAt(drop.getDropLocation()).setType(Material.AIR);
envoyHolograms.get(drop).remove();
}
envoyDrops.clear();
envoyHolograms.clear();
HandlerList.unregisterAll(envoyListener);
endCountdown.cancel();
plugin.getAPI().beginEnvoyCountdown();
// TODO: send message
}
I need that to run when the plugin disables, but it seems I cant do any of that in onDisable
alright so
list.addAll() returned as empty after the list was empty. could be getting the path wrong...?
MoveCraft?
That?
That's relatively old 🤔
https://www.spigotmc.org/resources/big-doors.58669/ can probably be a replacement for it
Despite it being called "Big Doors", there's a plane flying across the first image
alright im just gonna jump off a cliff man
addAll just doesnt even addAll
erdtuyuhijop ive broken my brain too much
getActivePotionEffects() is not mutable
player.getActivePotionEffects().forEach(e -> player.removePotionEffect(e.getType()))
ah gotcha thanks
ok cool so now my list just resets itself when i do it idk whats going on anymore man
so when I run list.clear() it seems to clear the list it is being based off of as well, although I did addAll() I never made them.. the same??
private final List<String> list = new ArrayList<>();
if (...) {
list.clear(); // List = []
player.sendMessage(permList.toArray(new String[0])); // sends me the list, proving that the list exists and is a list
list.addAll(permList); // List SHOULD = permList's values, but list = []
// I have also tried:
// list.addAll(Arrays.asList(permList.toArray(new String[0])));
list.add(args); // list adds args
config.set(path, list); // permList is set to list...
config.save(configFile);
}
I also printed the list after running list.clear() and it was just.... []
what in the world is happening
why am i so dumb
at this point you would probably be better off showing all your code @tiny pebble lol
any ideas?
are you sure you want to see my monstrosity
I've looked the error and relevant code over and I don't see why the material would be null...
in onClick event material is null @stoic shell
well it is possible that where someone clicks
is nothing
should check to ensure that what is being clicked isn't Air 😉
https://hastebin.com/puvazeyobo.js if you can read this and comprehend this props to you cause it's hella beginner code lmfao
Could separate this out between a few classes
but I'm the right item
yeah i could but i wasn't sure how to go about that seeing as it was all the same command
not sure about you being the right item
the thing is, it was working for the first few clicks, and now anything I click is null
@tiny pebble I will give you a link to an example
neato
thanks 😛
btw line 161 is where my issue starts.
line 173 is where the list stuff starts
so instead of trying to do this in the command class
why don't you cache your configs at the start of the server
Here is a snippet of the area in OpenGameSettingsSizeMenu:
int i;
for (i = 0; i < game.GetTeamsCount(); ++i) {
TeamBridge teamBridge = game.teams.get(i);
TeamColor teamColor = new TeamColor("&f", "Not setup yet", Color.WHITE, DyeColor.WHITE);
if (teamBridge.color != -1) {
teamColor = Saves.teamColors.get(teamBridge.color);
}
DyeColor dyeColor = teamColor.getDyeColor();
Material terracottaMaterial = DYE_TO_TERRACOTTA.get(dyeColor);
ItemStack it = GeneralMethods.CreateItem(ChatColor.DARK_PURPLE.toString() + (i + 1) + ". team", GeneralMethods.arrayToList(new String[]{teamColor.getChatColor() + teamColor.getTeamName()}), terracottaMaterial);
it.setAmount(teamBridge.color + 2);
inv.setItem(teamColorSlots[i], it);
}```
how would i manage to get the target users UUID then 🤔
you don't need to know that stuff to cache it
why would terracottaMatterial suddenly start being null...
how exactly would i cache it then?
the exact path of the list i want to get involves the uuid which is why i put it in my command class
I understand
but you don't need to know which UUID's you want to cache the UUID's ahead of time
You can parse through your yaml file for configuration sections
and cache the data based on what it is for
So since you have UUID's not hard to create a HashMap with the key being UUID's
value being whatever is stored for said UUID
now anytime you want data for that UUID, it is just a matter of looking at the hashmap
is this more-so for an organization type thing / easier access or would that hypothetically solve my problem?
ah i see
so instead of accessing the config file everytime
you access the hashmap
or a custom object
you can have custom objects that you put into hashmaps too 😛
i'll have to learn how to cache the config, but other than that i think i could do it
could make a function for all this too so i don't have to write line after line of editing the list? shrug
but thank you for putting up with my nonsense, i've been trying to solve this problem literally the entire day and i'm just so exhausted haha
Hi everyone! Quick question, does anyone know of a plugin that keeps chunks active if there's a chest minecart with items in it?
@tiny pebble it is a good learning experience
right now im just setting up the hashmap then im just gonna go to bed 😂
just because something exists in the API doesn't always mean it works like it is suppose to or doesn't come without problems. So when that happens, roll your own solutions 😛
may not create the best thing to solve it, but once you solve it
you can always work on making it better 😉
thank you 🙂
Well do what you can, also of note can always make it open source as well maybe others might make some PR's 😛
but, regardless some of us are always here to help lol
yeah and i'm glad i found a server that helps me even with the little experience i have
I have been helping people since nearly the beginning of MC XD
damn, that's quite impressive
now if I can just get my post count up, maybe I can apply for staff for spigot 😛
good luck!
used to be Bukkit Dev Staff now maybe its time to try my hand at some point being spigotmc staff 😉
i think you'd get it, but i know nothing about the spigot staff branch haha 😛
there is a prerequisite you have to meet before you can apply
I am more interested in being resource staff then anything else
huh...
strange thing is that I can't find any code doing anything when the 2 team setup wool are clicked
i've not quite sure what the staff here do other than help us out, seeing as that's all i participate in with this community 😅
all the rest of the items in the settings have checks
but I can't find any code checking for a click on the team setup wool
ah, so a ghost bug
those are always fun
lets hope it doesn't resolve itself before you figure out the cause of it 😛
because then that is even more confusing then having the bug originally XD
no it won't
Isn’t FileConfiguration already a cache technically
Or does that read the file each time you call a method
FileConfiguration is basically a glorified hashmap
it is, but it isn't the same as using a hashmap
That’s what I figured
well, i have the users UUID and permissions shoved into a hashmap, now i just gotta figure out how to add to the value of the hashmap. but that's for another day, because sleep is pretty neat
but I still can't find why Material is null .-.
also have a function to update the hashmap ^-^
oh...
if (teamBridge.color != -1) {
teamColor = Saves.teamColors.get(teamBridge.color);
}```
hashmap already has a function to update it
the teamColor could be null if something is going wrong with saving, couldn't it?
wonder where that magic value is coming from
snippet:
also if its a int then it cant be null
} else if (e.getView().getTitle().startsWith("Game Settings: ")) {
gameName = (String)listener.main.editMode.get(player.getName());
game = (Game)listener.main.gamesList.get(gameName);
if (item != null && item.hasItemMeta() && item.getItemMeta().hasDisplayName()) {
buttonName = item.getItemMeta().getDisplayName();
e.setCancelled(true);
if (buttonName.equals(ChatColor.DARK_PURPLE.toString() + "1. team")) {
color = item.getAmount() - 2;
if (e.isLeftClick() && color > 0) {
--((TeamBridge)game.teams.get(0)).color;
} else if (e.isRightClick() && color < Saves.teamColors.size() - 1) {
++((TeamBridge)game.teams.get(0)).color;
}
listener.main.OpenGameSettingsSizeMenu(player);```
check repeats 4 times for 2. 3. and 4.
see anything weird here?
yes a bunch of magic values
huh?
magic values are hardcoded numbers
oh
does it check for 0
what issue?
huh?
well your first snippet checks if it isn't equal to -1
what is the "it" you refer to?
did you register it?
wdym
Implement Listener and make sure you register your event class in your onEnable()
extended version of first snippet:
I am implementing listener
Did you register an instance of your Listener class with the PluginManager?
oh yeah that part
if (this.editMode.containsKey(player.getName())) {
String gameName = this.editMode.get(player.getName());
Game game = this.gamesList.get(gameName);
Inventory inv = Bukkit.createInventory(null, 45, "Game Settings: " + gameName);
int[] teamColorSlots = new int[]{10, 12, 14, 16};
int i;
for (i = 0; i < game.GetTeamsCount(); ++i) {
TeamBridge teamBridge = game.teams.get(i);
TeamColor teamColor = new TeamColor("§f", "Not setup yet", Color.WHITE, DyeColor.WHITE);
if (teamBridge.color != -1) {
teamColor = Saves.teamColors.get(teamBridge.color);
}
DyeColor dyeColor = teamColor.getDyeColor();
Material terracottaMaterial = DYE_TO_TERRACOTTA.get(dyeColor);
ItemStack it = GeneralMethods.CreateItem(ChatColor.DARK_PURPLE.toString() + (i + 1) + ". team", GeneralMethods.arrayToList(new String[]{teamColor.getChatColor() + teamColor.getTeamName()}), terracottaMaterial);
it.setAmount(teamBridge.color + 2);
inv.setItem(teamColorSlots[i], it);
}
(...)
ty
Wait actually in the same class
@EventHandler
public void onInventoryDrag(final InventoryDragEvent e) {
if (e.getInventory() == inv) {
e.setCancelled(true);
}
}
this works fine
sysout in the beginning of the method to see if it fires.
so if it's not setup, it makes a white terracotta
InventoryDrag fires, closeInventory doesn't
but the other snippet changes, the color, and then calls the method again, right?
uh
public class TeamBridge {
public int color = -1;
public Location spawn;
public Location respawn;
public Location pit;
public List<String> gamePlayers = new ArrayList();
public PointsEntry entryPit = new PointsEntry();
int scorePoints = 0;
public Team teamDisplay;
public TeamColor teamColor;```
default?
@lyric cypress Not possible. Every method that is annotated with EventHandler and has exactly one argument of type Event will be registered and fires.
i just meant whenever the value of the hashmap changes then update it, or is the value and the hashmap forever linked? lmao idk how it works entirely im tired
so there's the -1
Values in the hashmap don't update automatically
aight that’s what i meant when i made the function that updates it
ah ok
@EventHandler
public void closeInventory(final InventoryCloseEvent event) {
Bukkit.broadcastMessage("closeInventory firing");
this doesn't log anything
when i close my inventory
hmm
so there's gotta be something wrong with this:
color = item.getAmount() - 2;
if (e.isLeftClick() && color > 0) {
--((TeamBridge)game.teams.get(0)).color;
} else if (e.isRightClick() && color < Saves.teamColors.size() - 1) {
++((TeamBridge)game.teams.get(0)).color;
}
listener.main.OpenGameSettingsSizeMenu(player);```
but idk what
@lyric cypress But you have another eventhandler method in the same class that fires?
yes
public class RewardStorage implements Listener {
public Inventory inv;
public RewardStorage() {
inv = Bukkit.createInventory(null, 9, ChatColor.GOLD + "Unclaimed Rewards");
}
public void openInventory(HumanEntity ent) {
ent.openInventory(inv);
}
@EventHandler
public void onInventoryClick(final InventoryClickEvent e) {
Bukkit.broadcastMessage("this fires");
}
@EventHandler
public void closeInventory(final InventoryCloseEvent event) {
Bukkit.broadcastMessage("this doesn't");
}
}
Not possible. Did you make sure to export this version and copy it into your plugin dir?
yes
hmm
I added debug logging
if (teamBridge.color != -1) {
teamColor = Saves.teamColors.get(teamBridge.color);
Bukkit.getLogger().info(String.valueOf(teamBridge.color));
}
I right clicked... and 0
then the Material error
InventoryCloseEvent does not fire if the player closes his own Inventory. Did you only test it with the player inventory?
I tested it with player inventory and this inventory
if (e.isLeftClick() && color > 0) {
--((TeamBridge)game.teams.get(0)).color;
} else if (e.isRightClick() && color < Saves.teamColors.size() - 1) {
++((TeamBridge)game.teams.get(0)).color;
}
this check is flawed
now I'll try logging getDyeColor
specifically the second portion of it is flawed
So you are telling me that if you open any chest, click in slots then close it.
You will see "this fires" for clicks and nothing else?
That is completely impossible.
So do both events fire?
no only InventoryClickEvent
and getColor gives me Color:[rgb0xED2828]
so now the question is... why is getDyeColor() returning null?
well getColor and DyeColor are two separate things
you can have color for something but not have dyecolor
oh wait actually
@lyric cypress There are only 2 possiblities here.
- You dont show your whole code.
- You got a broken Spigot version (which i doubt)
huh...
alright so...
I've calculated the dyecolor with DyeColor.getByColor(color);
I thought this would approximate, why isn't it?
oh...
alright, so how can I approximate?
would have to know the ranges
I don't know the range of DyeColor in relation to the range of Color
how have people done this previously?
But essentially you need to know the range of DyeColor so you know how to tell what your color is closer to as far as DyeColor goes
I am not sure
I don't normally mess with DyeColors 😛
I just know that you can have a color but not a DyeColor lol
/**
* Represents white dye.
*/
WHITE(0x0, 0xF, Color.fromRGB(0xF9FFFE), Color.fromRGB(0xF0F0F0)),
/**
* Represents orange dye.
*/
ORANGE(0x1, 0xE, Color.fromRGB(0xF9801D), Color.fromRGB(0xEB8844)),
/**
* Represents magenta dye.
*/
MAGENTA(0x2, 0xD, Color.fromRGB(0xC74EBD), Color.fromRGB(0xC354CD)),
/**
* Represents light blue dye.
*/
LIGHT_BLUE(0x3, 0xC, Color.fromRGB(0x3AB3DA), Color.fromRGB(0x6689D3)),
/**
* Represents yellow dye.
*/
YELLOW(0x4, 0xB, Color.fromRGB(0xFED83D), Color.fromRGB(0xDECF2A)),
/**
* Represents lime dye.
*/
LIME(0x5, 0xA, Color.fromRGB(0x80C71F), Color.fromRGB(0x41CD34)),
/**
* Represents pink dye.
*/
PINK(0x6, 0x9, Color.fromRGB(0xF38BAA), Color.fromRGB(0xD88198)),
/**
* Represents gray dye.
*/
GRAY(0x7, 0x8, Color.fromRGB(0x474F52), Color.fromRGB(0x434343)),
/**
* Represents light gray dye.
*/
LIGHT_GRAY(0x8, 0x7, Color.fromRGB(0x9D9D97), Color.fromRGB(0xABABAB)),
/**
* Represents cyan dye.
*/
CYAN(0x9, 0x6, Color.fromRGB(0x169C9C), Color.fromRGB(0x287697)),
/**
* Represents purple dye.
*/
PURPLE(0xA, 0x5, Color.fromRGB(0x8932B8), Color.fromRGB(0x7B2FBE)),
/**
* Represents blue dye.
*/
BLUE(0xB, 0x4, Color.fromRGB(0x3C44AA), Color.fromRGB(0x253192)),
/**
* Represents brown dye.
*/
BROWN(0xC, 0x3, Color.fromRGB(0x835432), Color.fromRGB(0x51301A)),
/**
* Represents green dye.
*/
GREEN(0xD, 0x2, Color.fromRGB(0x5E7C16), Color.fromRGB(0x3B511A)),
/**
* Represents red dye.
*/
RED(0xE, 0x1, Color.fromRGB(0xB02E26), Color.fromRGB(0xB3312C)),
/**
* Represents black dye.
*/
BLACK(0xF, 0x0, Color.fromRGB(0x1D1D21), Color.fromRGB(0x1E1B1B));
From DyeColor enum
yes....?
there you go
um what am I doing with that?
the get by color is a Map<Color, DyeColor>
So you need the exact color
So, that contains your range
just turn them into ints and do a < > to see what is closer to what 😉
.-.
Also Guava has a RangeMap
You can create a RangeMap<Integer, Integer> and have a lookup table for your colors
ah didn't know that, good news is Guava is shaded into the server jar
so you only need to add it as dependency for your project, but no shading needed 😛
think spigot uses Guava 23?
I still have no clue on how to turn those words into actual code .-.
Think so yes
but you can't do range check with Hex at least I don't think you can, so you use the method to get their Int values instead
and then use the method as specified above to do a range check
Ok here is what you can do.
- Create a Comparator<DyeColor> that compares the DyeColor values by their color field (ascending or descending)
- Create a PriorityQueue or some other sorted collection that assures sorted iteration.
- Iterate and create a range between current and next element (thats your color range)
- Use the range in a RangeMap or use <> comparisons
To be honest to do this you need quite some experience with Java
I wouldnt bother with int values anyways...
Wait... is your color int maybe just the index of the DyeColor enum?
lol
looks like you will get to learn some quirks with the API 😛
never assume anything
XD
I have literally no plugins installed on my server and the server keeps switching from day to night each second
im very confused
Do I need to create a new class file for every command I add? or whats the right way of adding commands
It's good practice to have a separate class for each command.
you dont have to
but It makes it much easier to read through when your plugin grows
Anyone know where i can find code to make portals between a hub server... PVP and Survival and Event
theres plenty on the plugin store, just decompile one of them
Como se crea un server spigot?
Didn't I answer this earlier?
sounds like it might be in your plugin.yml but not registered in your onEnable
Or is this a different person
is there a way to use a TextComponent ClickEvent to just run a method or create an object? I was bypassing it by running commands but admins don't like getting console messages about players clicking these
Oh, different person lol. @tranquil edge
https://discordapp.com/channels/690411863766466590/690470011382267904/731326812747071550
@subtle blade https://www.youtube.com/watch?v=dv13gl0a-FA
Anime - Initial D
Song - Deja Vu
Artist - Super Eurobeat - Dave Rodgers
All rights and credits go to their respective owners.
I don't think there is another way aside from what you suggested - commands
bollocks
Have you actually assigned the command executor to your command?
because there is no possible condition where that would display the usage
@slim hemlock Does intercepting the PlayerCommandPreprocessEvent and cancelling it still throw out the message to the log?
you know that's what I was thinking about
but I was also wondering if that could be considered to be malicious behavior
since it's obfuscating commands
I don't think so. Just make it some arbitrary command
Like /helloimmagmaguyandthisisacommandusedfortextcomponents
lol
Cloud, your braces seem all out of whack. You're missing a brace on the args.length condition
eh at least for now I'll let admins know they can huff my shorts if they don't like the tracking commands
I'll reconsider it if too many people show up to huff them
Is there any way to hook into the cave generator using spigot?
Cloud... this was answered two times now.
Its immutable.
for (PotionEffect effect : player.getActivePotionEffects()) {
player.removePotionEffect(effect.getType());
}
getActivePotionEffects() does not return the actual List of effects
I thought you wanted to remove all effects from the player.
Yes. Also use early escapes.
eg
if(!commandSender.hasPermission("perm")){
return;
}
This way your code gets way more readable.
is PlayerDeathEvent#setKeepInventory(true) supposed to still have the items drop?
im currently using it, and i get the items dropped where i died and also i keep them, thus duplicating
https://www.youtube.com/watch?v=PWOABqGMvKs
Anyone know what's causing this? I have no plugins installed at all.
Wouldnt make much sense.
you coudl try getDrops().clear()
Isn’t this literally in the javadocs
ah
declaration: package: org.bukkit.event.entity, class: PlayerDeathEvent
It’s even bolded
Anyone know of a Packet Armorstand API that has support for equipment, like item on head, (plus the head rotation), also Item in hand, and arm pose
Ive asked many times today, sorry for bothering but this is very important to my project right now
Do you want completely packet based Armorstands?
yes
they are much more effective for performance, especially when needing to teleport them
Do you need to teleport them a lot?
Is there a reason you dont just use fake items and teleport them accordingly?
I dont believe you can make them have anti gravity
and also there is still a component needed with armorstands
its part of the animation before that
You can set Item's velocity to 0 so no gravity.
Maybe you can even extend the NMS item and let it not be affected by gravity.
You can still send spawn and teleport packets for those then
Well that would be the reason I'm in need of an API, im not great with nms, I can do it, but Im sure an API will provide something much better quality that I wont be able to make because of lack of experience.
Obviously I could gain that experience but ideally I dont want to spend 2 weeks on this
its just part of the loot system on my server
that solves only part of the problem, I would still need a way to set the head pose of the armorstand because there is a segment before the gif that uses an armorstand, and can only happen with an armorstand
I dont know any API for this... What version are you on?
1.8
If you code for a 6 years old version you need to be prepared to do everything on your own.
Just extend armor stand
The same way you would have extended the item
Or just use a normal armor stand
lol if minecraft would make a good combat update I would be able to move to a newer version, but even then, there are no sufficient armorstand apis
Alex, the problem is performance
So use packets
Packets aren’t that difficult to use
depends on which ones :p
You’re unlikely to find an API for what is a very specific use case
PacketPlayOutEntityMetadata is pretty bad lmfao
theres no documentation, and I have no Idea how to change the name of an entity with it
I've looked at protocol
What part are you missing
Because that has all the meta data information you could possibly need
Just look at the 3rd value of type field, it says string and doesnt provide any notes, I believed that was the name but I guess not
it doesn't matter anymore but im just saying packets arent always EASY
The type field is just what type the value is
Not a specific piece of metadata
So if the value was a string, the type would be that byte
To tell the client “hey this value I’m sending is a string, decode it like this”
2 OptChat Custom name empty
3 Boolean Is custom name visible false
Yes
this is all I had and when I tried to send that with the data watcher, it kicked me from the game
So you were sending what as index
OptChat isn’t a string
It’s a boolean followed by optional Chat
how do i sort a Set<>
Collections.sort?
depends on your type, but create an ArrayList copy then use #sort() or Collections#sort
would be smth like
List<X> list = new ArrayList<>(your set);
Collections.sort(list);
do magic with list or convert it to a set once again
dont you need to provide a comparator?
You cant really sort a Set unless its something like a SortedSet or LinkedHashSet