#help-development
1 messages · Page 1378 of 1
@Override
public void onEnable() {
if (!setupEconomy() ) {
log.severe(String.format("[%s] - Disabled due to no Vault dependency found!", getDescription().getName()));
getServer().getPluginManager().disablePlugin(this);
return;
}
setupPermissions();
setupChat();
}```
this is what the github page told me to do, so i did as it said lol
but yeah server starts up fine now, thank you
yeah which i guess makes sense
i didnt look at their github
i just googled bukkit add economy support to plugin or something like that
yes
Would anuone be able to write the code i need plz and pm it to me
depends, what is it
I need to get the args0 of a command from the com.class to the event.class for my gamemodegui
what
and why cant you write this yourself lol
Cmd.class
Basically they want a map uuid -> uuid that can be set in a command and read in an event
The class names are examples
store it in config/array
depending on whats needed
No, just a map
No need to persist the data when the server stops
idk how to use maps lol
Neather do i
But how do i call for that from a different class
Make a getter
oh yeah nvm
ive used maps before then
yeah i have a single HashMap
public static HashMap<Long, ArrayList<Integer[]>> RedstoneEvents = new HashMap<>();
Ahh static
@humble heath Have you written a working plugin before?
map of list of array
No
D:
what are the variables for exactly?
its all runtime data
or constants
plugins are singletons
or single instance fields
just keep static stuff in your plugin main class
Okay yes that too
^ but not static
But you get the idea
itd be a mess
theres better ways lol
That’s what dependency injection is for
I do like the singleton pattern for manager classes, but I still avoid it
idk how to DI
just pass it in the constructor
Yes that’s generally the idea
which is no fun
just have the instance in your plugin class
I pass my plugin instance around a lot
then DI your plugin class
then you can reference it from plugin#getRuntimeStore().....
static is always easier, but almost never right
makes for cleaner code imo
and less efficient
It’s generally the opposite of cleaner code
You’ve reminded me I was going to mess with that old bloodmoon plugin today
Oh well, always tomorrow
xD
I had to use wayback machine just to find the old page for it
@eternal oxide yea
All i need is the code to save the playername to a hashmap and how to access that from a different class plz
Never used hashmaps b4
% brew install maven
==> Searching for similarly named formulae...
Error: No similarly named formulae found.
Error: No available formula or cask with the name "maven".
==> Searching for a previously deleted formula (in the last month)...
Error: No previously deleted formula found.
==> Searching taps on GitHub...
Error: No formulae found in taps.
It would be easier if you properly explained what you are trying to do. Just storing a set of args to access in another class is not clear enough.
I have my gamemode gui working but i am struggling to get the playername from the command in to the event class to run the playername.setgamemode(creative)
if its a gui it shoudl use no commands
What you mean no commands
And if its just setting a gamemode it should not be done in an event class other than teh gui class
@eternal oxide can you please help me
I have no clue what your question is
why is this not working
A GUI does not use commands. It registers events that happen when items in teh GUI are clicked
What is that? I don;t recognise it as anythign Spigot
homebrew (to install maven)
I got a second computer (mac)
but ive never used a mac
So yea that is what i am trying to do when someone clicks the item it changes there gamemode but i need to get the players name to the event class
I've not used a mac since I was a Mac engineer back in 1997
try brew install maven@3.6.3
aight
No, the player will be in the event that clicked
why do you need a command for that
usually event.getWhoClicked()
% brew install maven
==> Searching for similarly named formulae...
Error: No similarly named formulae found.
Error: No available formula or cask with the name "maven".
==> Searching for a previously deleted formula (in the last month)...
Error: No previously deleted formula found.
==> Searching taps on GitHub...
Error: No formulae found in taps.
zoibox@Williams-MacBook-Pro ~ % brew install maven@3.6.3
Updating Homebrew...
fatal: Could not resolve HEAD to a revision
==> Auto-updated Homebrew!
Updated 1 tap (homebrew/cask).
==> Updated Casks
Updated 7 casks.
==> Searching for similarly named formulae...
Error: No similarly named formulae found.
Error: No available formula or cask with the name "maven@3.6.3".
==> Searching for a previously deleted formula (in the last month)...
Error: No previously deleted formula found.
==> Searching taps on GitHub...
Error: No formulae found in taps.
lolnot command the cmd i write is /gmg playername to change another persons gammode
this is homebrew
Then thats not a GUI
not mac
Do you mean it pulls up a GUI so you can set that player?
Yes
They want to run the command, and then pull up a GUI to set the gamemode for the target player
Then you need to pass the player name from yoru command to your GUI, which is simple dependency injection.
How
no
args is an array, it will never == 1
if you dream hard enough it will
How do I make it so then the console can send a message to the people who have the correct permissions?
So you run testmessage hi in console then
[TestMessage] Console: hi <-- Gets sent to the people who has the correct permissions?
If I try player.sendmessage it sends back a null error. Any ideas?
i think Bukkit.broadcastMessage has an overflow method for perm
declaration: package: org.bukkit, class: Bukkit
i'm not good in java, but I think you can get the list of player, you make a for loop for each player, if the player has a permission, send it the message
maybe it's wrong what im saying
yeah you can do that aswell, but bukkit has a method for it already
oh okay nice
I have tried that but it broadcasts to everyone not to the specific people who has the perm.
show your code
yeah then do what vs said
I will send u my code tonight @eternal oxide
for(Player player : Bukkit.getOnlinePlayers()){
if(player.hasPermission("myPerm")
player.sendMessage("message");
}
Add the perm as the second argument
halp how do i fix my scoreboard to not flicker D;
lemme guess 1.8?
Do you guys know why, if I update an armorstand's headpose each tick, it only appear s to update ~5 times per second (very stuttery)?
Don;t recreate scoreboards, update them
can we see code?
teleporting heads doesn't interpolate movement so naturally you are going to get stutters
for head pose?
Its in a loop each tick
No not for headpose
There are no velocities for headpose
only setHeadpose
this is inside a runnable task?
hmm i see no reason why it would be doing that
do you have any expensive calculations in your runnable?
what sort of calculations?
yeah that would be best
I have some models you wont know about but youll get an idea of it
lemme get a pastebin
I am also riding the armorstand btw
no thats not true
I am riding a different armorstand
changed that recently lol
nothing in there is really expensive to calculate
Thats what I thought
rotations and stuff are smooth
Armorstand with velocity updates each tick are too
But headpose is just like nah bruh
just head movement?
im not sure how expensive converting radians to euler is
you could try simplify pi to a lower decimal
hmm could be it but i dont think thats causing any problems
how about
you try to JUST change the head pose
and see how that fairs
try and eliminate all other factors
best time to code imo lol
woops falling through the world xD
Whats the minimum headpose incremental?
is it just 1 degree radians?
I'd assume so
Still same problem rip
I could try a different task thats rotating it incrementally
see if thats smooth
i doubt that owudl do much
if you've cut down everything else
can i see what code you have now
Well its kinda hard to cut down everything since its a few files working together
difficult to explain
Yep
my only idea is the eulerAngle
because its calculating pi
but that really shouldnt be that expensive
lets try to fix that then
nah i mean radians calculation
but i doubt thatd do anything
maybe eulerangle is just slow ye
doesnt change anything
but if changing the headpose is laggy, that means everything else would lag
since its on the same thread
Yea thats the weird thing
so I'm assuming you're not incrementing the headPose enough
that could be it honestly!
That it only updates if change is higher than 0.1 for example
lets see
maybe clamp it
float eulerRot = modelRotationOffset - steerRadians;
if(curTurn != 0 && speed > 0){
double newTilt = turnSpeed * curTurn *.04;
if(Math.abs(eulerRot - prevEulerAngleRot) > 0.1){
vehicleModel.setHeadPose(new EulerAngle(0, modelRotationOffset - steerRadians, 0));
prevEulerAngleRot = eulerRot;
}
}else{
if(Math.abs(eulerRot - prevEulerAngleRot) > 0.1){
vehicleModel.setHeadPose(new EulerAngle(0, modelRotationOffset - steerRadians, 0));
prevEulerAngleRot = eulerRot;
}
turnSpeed = minTurnSpeed;
}
changed it to this
but now its more stuttery lol, lets try to reduce it
hm other than that i dont think it's possible to smooth it anymore
unless you have a way to interpolate your movement
hmm damn
iirc head movement has a "catching point"
so you have to move the camera enough from the intial head rotation for it to actually move
thus, why you're gettign that, because you arent incrementing enough, by the time you do increment by enough it snaps to that point
also, the setting headpose makes the armorstand velocities shake more than if theyre gone
Can I share my screen with you real quick in personal call? Ill mute myself, just for the screen
I can't atm sorry.
yeah minecraft does some dodgey with small values lol
ran into similar issues when trying to animate armorstands a bit ago
yeah thats similar to what im doing
does the rotation of your armorstand's body matter much?
It also needs tilt in the end :/
ah damn
but if i scratch the tilt, i could definitely do that
because i use teleportation for my animation and it works 100% smooth
and that minimum head movement thing wouldnt be a problem at that point
may i ask
what is this for?
i see vehicle in your code so i was thinking cars or something
right
yeah but teleporting seems the smoothest way of doing it
if i had videos of my system i would should you, but it works great
awesome
But now the tilting, lets see
Thats ok
i think thats a compromise you have to make
yeah lmao
Oh right, when im setting headposes and yaw
it glitches
rotation is like: nah bro now im 45 degrees off of what you tell me to do
i can make screen
its nothing to do with pitch tho :/
its just yaw
Can i send you a picture quickly
sure
whats that from?
Looks pretty self explanatory.
Sometimes you can ignore such warnings
Looks liek you are doing some instanceOf on a type you already know from line 105
yes i know duplicate piglin check
monster will encapsulate all of those other checks wont it
thats a lot of checks ngl maybe use an EnumSet<EntityType> for a bit faster performance?
yeah, it will look at the e instanceof Monster operation and waste processing power for the rest if I am not wrong
its going to pass on Monster and never get to any of the Piglins
you do realise e instanceof Monster will be true for all of those other checks
so you onyl need the one check
or if it fails on Monster its never going to pass Piglin
Why would the not be though?
I sort of get why slime wouldn't be
phantom extends Flying
which extends Mob
Slime is mob too
Shulker is Golem and Colorable
Ghast is Flying
so stupid coding lel
lol
Yep, you are correct. Even though this is really stupid, I'd PR that but I don't have the needed accounts so ¯_(ツ)_/¯
?
Bukkit is irrelevant, cb is more important
essentially the same no?
declaration: package: org.bukkit.entity, interface: Ghast
they go hand in hand
not really
Not really, there are a few differences
In this case it is irrelevant, the only thing that would complain is the IDE as you know more than it
public class UrMum extends Rideable
make a plugin for it lel
Bukkit is the API, CraftBukkit is the implementation.
definitions stay the same
i mean it didnt really matter as for this convo right now
ended up with using scoreboard api 😛
scoreboards arent THAT hard
pfft i hate them xD i always sucked at making them ¯_(ツ)_/¯
non flickering? 🤔
that was my issue tried so many ways non of them solved
so ended up with using api
it only flickers if you create new ones
even with buffer and teams it flickered
yeah non flickering lol
then ig i have no luck with bukkit scoreboard api
^ do once per player per scoreboard and never again
i havent had flickering
No flickering here too
jealous noises xD i legit ended up with using api ;-;
Though how do you make use of the scores? Or do you create objectives for that?
is it save to have em all as 0 tho?
yes if you set it up correctly
each line is a scoreboard entry
You need #help-server
ah
hey i try using placeholderapi but it doesnt return placeholders? no errors in console
code: https://paste.md-5.net/lolawalamu.js
um, thats not how to use Placeholder API
oh idk because it worked for me all time
wait it is supposed to do it like that? https://github.com/PlaceholderAPI/PlaceholderAPI/wiki/Hook-into-PlaceholderAPI#setting-placeholders-in-your-plugin
Check for the plugin not reflectively look for the class.
my plugin isnt the bad side i think papi is
you shoudl set a flag field in your onEnable to say if you have the plugin
what is all? in PlaceholderAPI.setPlaceholders(all, line)
That should be a Player or an OfflinePlayer
i wonder
its Player
what are you currently seeing as the end result?
add debug to see which section of code is being run. The placeholder code or the exception code
in that case its going to fail to get teh line as you changed it
Why he's using try catch to check If PAPI is enabled/installed on the server?
because he's not too good at programming?
As I said earlier you need to test in onEnable and set a flag if its present
you just then check yoru flag to see which code you need to run.
i did this and it returns works
if (Bukkit.getPluginManager().getPlugin("PlaceholderAPI") != null) {
/*
* We register the EventListener here, when PlaceholderAPI is installed.
* Since all events are in the main class (this class), we simply use "this"
/
setupScoreboard();
log("works");
} else {
/
* We inform about the fact that PlaceholderAPI isn't installed and then
* disable this plugin to prevent issues.
*/
log("Could not find PlaceholderAPI! This plugin is required.");
Bukkit.getPluginManager().disablePlugin(this);
}
you could replace all that by adding in your plugin.yml a depend: [PlaceholderAPI]
rly
.
a depend means your plugin will not start if the depend is not satisfied
Yes, I expected your plugin to run without placeholderAPI
i know
else you'd not be doing a try/catch
well ya
So, if your plugin can run without placeholder you need to flag ifd its found. Else just add a depend and you can completely ignore any tests
okay
Any idear how i can fetch the name from the second part of my command in the cmd in my lisener class to be able to set the player name
@eternal oxide do you understand what i am trying to do
If (args.length() > 0) Player player = Bukkit.getPlayer(args[0]);
Yes but it is a gui
then check if player != null
I have all that works
But when i do catch 5: target.setgamemode(Gamemods.creative); it cant find set gamemode in listener class i need to get the player name over from commandexecuter class
you need to pass the player to the gui you open for the command issuer
Yep that is what i need to know hpw to do
I'm going to assume you use something like new GUI() instead do new GUI(player)
Im can’t remember i will send you cmdexecuter code when i get home
@brave glenhandeler
huh
they joined like, an hour ago lol
their fault for being called "event" xD
wait nvm
that was 2 months ago
and its not even 4am
im retarded :LUL:
oh, no external emotes, ok
Public void onClickinventouryevent(Inventoryclickevent e){
Switch slot(){
Catch 1: target.setgamemode(GAMEMODE.CREATIVE);
e.setCanceld(true);
Break;
until you show how you are opening your GUI we can go no further
@Override
public boolean onCommand(CommandSender sender, Command cmd, String lable, String[] args) {
if (sender instanceof Player) {
Player p = (Player) sender;
int i = 1;
String pname = p.getName();
if (!p.hasPermission("ee.gmgui")) {
sender.sendMessage(Utilities.color(Prefix + NoPerm));
return true;
}
if (cmd.getName().equalsIgnoreCase("gm")) {
if (args.length < 1) {
sender.sendMessage(Utilities.color(Prefix + SpecifyPlayer));
return true;
}
if (args.length == 1) {
Player T = Bukkit.getPlayer(args[0]);
if (T == null) {
sender.sendMessage(Utilities.color("&4Player Not Valid"));
return true;
}
ArrayList<String> lore = new ArrayList<String>();
Inventory inv = Bukkit.createInventory(p, 18, "GamemodeGui " + T.getDisplayName());
//Player skull
int lifePlayer = (int) p.getHealth();
ItemStack item = new ItemStack(Material.PLAYER_HEAD);
SkullMeta skull = (SkullMeta) item.getItemMeta();
skull.setDisplayName("§c§l" + T.getName());
lore.add("the player you are going to punish");
skull.setLore(lore);
skull.setOwner(T.getName());
item.setItemMeta(skull);
inv.setItem(4, item);
//item 1
ItemStack item1 = new ItemStack(Material.RED_CONCRETE);
ItemMeta meta1 = item1.getItemMeta();
ItemMeta im = item1.getItemMeta();
meta1.setDisplayName(Utilities.color("&4Gamemode Creative"));
meta1.setLore(Arrays.asList("Set "
jesus
?paste
ok you have the name on your skull ItemStack
ok, then set meta on the itemstack you are putting in yoru UI
Like
O ok but how i ref it in the listener I tryed with the skull but could not change the gamemode can i use the tital
set meta for the player name or uuid on the itemstack. Then in teh click event you read that same meta to get the name back
heck you already set it in the lore
Put the name in the gui title ie change planame gamemode
you could
what u wanna do
Elgarl knows
You have already set teh name in multiple places. Just read it back
@ivory sleet i am here
hi i have a problem with placeholderapi not working with Bukkit.getOnlinePlayers()?
/gmg playername player name in gui tital. Then in event class pull the playername out the title so i can change the gamemode
@ivory sleet
event.getView().getTitle()
I have all the gui set up
But how do i remove the rest of the gui title or do i just set it as the playername
you could use String.split
split is a basic java method google will tell you all about it
Don’t get that can you write the code i need plz
does spigot have gson inbuilt?
I've always shaded it but never really cared to check if i needed to
epig
had to finish assignment
u wanna make a gui?
I have the gui i just need the name in the event class
@ivory sleet he already had a GUI, However I don't know how. He's just not willing to read how to use String#split
lol
I have I don’t understand it
Pls show us the code you have so far. And take it unhurriedly. Create new variables to prevent stacking
of method calls like that. This clarifies the code quite a bit.
lmao why
its so easy
u can even use intellisense
He seems to have almost zero java knowledge. Its all copy/paste and he's unable to understand something very simple such as passing a variable between classes or String#split.
poor @ event lmao
can't you do like InventoryOpenEvent#getView#getName or something?
unless that's not what he wants
idk what he wants
Thats what I told him. just use String#split to get the name. He doesn't understand split.
why would he need to split?
because the title isn;t just the name
oh
the name is in the title and in every line of the Lore.
why?
I suggested just add the name itself as meta but he didn;t understand that either. Just wanted me to give him the code.
wait let me get this straig
lets say we have an inventory with tile Suitcase
we have a vanilla (non-edited) stone sword, then an empty space, then a peice of bread
what would the name be
His inventory has blocks for each gamemode. so he added lore to each for "set gamemode Survival: playername"
package index
he also set a title that has the players name on the end
he simply can't understand how to get the name off the end of a string
and the school wifi doen't let u visit spigot cuz it thinks its forums
I even linked how to use split https://www.guru99.com/how-to-split-a-string-in-java.html
Is there a way to force-update light on the client side?
Magic 8 ball says...
is the error your computer melting?
does it rm -rf your drive?
i think you're joking but at this point i have no idea
read your latest.log on your server
show plugin.yml too
no not screenshots
A sensible, modern pastebin. Share text and source code snippets with no hassle.
use a paste site
?paste
I I struggle with understanding things i am still only learning
You need to stop copy/pasting code and try understanding what each line does
I do
then you'll understand the lines where you added Lore
I know that
I used lore with the head and when I tried target it still didn’t work
Im on my way home now anyway
Error: https://paste.md-5.net/exilokafay.bash
Code on Main class line 13: new CreateRecipe(this);
CreateRecipe.java:18
plugin.getCommand("createrecipe").setExecutor(this);
is that command in your plugin.yml?
yes
bet its not
send that over too
or plugin is null
sending it one sec
?paste
plugin.yml: https://paste.md-5.net/taniqaqilo.http
plugin is null
Your plugin field is null in CreateRecipe.java
CreateRecipe Class: https://paste.md-5.net/iginomixan.java
well then thats very cursed
?
https://gyazo.com/684418e2b260b8217736b2cdd9510c47 was this changed? using 1.16 api
what was changed
you're referring to the event as e, not event
public CreateRecipe(Main main) {
this.plugin = plugin;``` You call it main and try to use plugin
you set plugin to itself
no, they obviously aren't trying to see the typo they made, they just wanna see what changed!
sorry bossman oskar
oh i forgot that im on crack
What do you mean what has changed?
no
How do people here go about adding config values once their plugin's been released, without the users needing to add the config values manually?
most plugins tell users to delete their config when upgrading
Oh really? Fair enough then lol
thanks for the heads up :)
no, I've gathered from 3 hours of trying lol
i can send demo of how i do it, but it isnt a spigot plugin
paper?
nope
If you wouldn't mind, that would be great
The config file: https://github.com/OskarsMC-Plugins/message/blob/main/src/main/resources/config.toml#L22
Checking the version: https://github.com/OskarsMC-Plugins/message/blob/main/src/main/java/com/oskarsmc/message/util/VersionUtils.java
Informing the user: https://github.com/OskarsMC-Plugins/message/blob/main/src/main/java/com/oskarsmc/message/Message.java#L47
should be somewhat similar when you implement it in spigot
it's an incoorrect name lmao
thank you very much \o/
Im running into problems setting the helmet of my Giant, I can set it to a Diamond Helmet without problems, but when I try to set it to a block (like a carved pumpkin) or a player head, it doesn't show up. Does anybody know how I can fix this issue?
Here's my code (Kotlin):
entity = origin.world!!.spawnEntity(origin, EntityType.GIANT) as Giant
entity!!.isInvisible = true
entity!!.customName = "discoDomeBall"
entity!!.equipment!!.helmet
entity!!.equipment!!.setHelmet(ItemStack(Material.PLAYER_HEAD), true)
//entity!!.equipment!!.setHelmet(Util.urlHead("456df2ff06e0713819ae062899130ae0bfc67c5121db7ce951f4aaa3b20f072c"), true)
entity!!.setAI(false)
entity!!.isSilent = true
entity!!.isInvulnerable = true
}```
hey i am having a config with this content https://paste.md-5.net/ahusocacux.makefile and i am trying to check one string (map4) in the HisenCZ.buildedMaps but idk how to do it
what are the exclamation marks for?
getConfig().getStringList("HisenCZ.buildedMaps")
ik that but im trying to check from the stringlist if there is a string "map4" in the list
.contains("map4")
The code is in Kotlin, the exclamation marks have to do with things not being null
oh it would be useful if you stated that :p
okey ill try
But the most important line is entity!!.equipment!!.setHelmet(ItemStack(Material.PLAYER_HEAD), true), which in java is entity.getEquipment().setHelmet(new ItemStack(Material.PLAYER_HEAD), true);
I just cant get it to work when I change the material from DIAMOND_HELMET (or another type of helmet) to a block
I think I remember md_5 saying something about blocks as helmets do not scale
I'm having a regex error, here is the error:
I'll try it out with a normal zombie, but I did get the helmet to be really big
As you can probably tell, I am trying to replace the name of a ChatColor typed in the chat with it's corresponding color, unless there is a backslash before it
but the error only occurs when processing the replacement for the color BLACK
Can anyone help me?
Hi, why when I change player's gamemode on respawn event he has not the noclip
me ?
Yeah
Yep, when I try a normal zombie it does work. I'll try to find another way then to get a giant head
You mean, it doesn't change them to spectator?
Its java so escape codes \w*(?<!\\)BLACK
Wait, so in my IDE I would put \w*(?<!\\\\)BLACK?
no, two \
I do have that already
you posted a single here
the compiler will throw an error if you just have a lone backslash anyway
Nah, what I posted is what the compiler sends through the regex
In most compilers, backslashes are a compiler-side escape token, so if you just want to leave one in a string you have to put another backslash before it
@cloud current Still need help?
Can you give me the part of your code that contains the event?
@woeful crescent ```java
@EventHandler
public void onRespawn(PlayerRespawnEvent event) {
Player killer = event.getPlayer().getKiller();
Location location = event.getRespawnLocation();
if (killer != null)
location = killer.getLocation().add(0, 3, 0);
else if (CashPrice.getInstance().getManager().getSpawnPoint() != null)
location = CashPrice.getInstance().getManager().getSpawnPoint();
event.setRespawnLocation(location);
event.getPlayer().setGameMode(GameMode.SPECTATOR)
}
I won't upgrade the plugin
kotlin null safety
yeah the other person told me
oh yes normally why
I'm not using any NMS
net.minecraft.server
And plugins making use of legacy code might not be compatible as there is a vocal amount demanding a sweep of old code
If you cannot do anything otherwise
its mojang's code so its not provided in the api maven repos
so other than installing the repo locally you cant really use it
well, you have to build spigot/craftbukkit in order to use it
Or use repositories that I would consider to be illegal
Hey, im currently Developing a "The Bridge" Plugin. I wanna reset the World after a Round finished, how can i do that?
the whole world?
Disable autosave and restart the server :thinksmart:
this
Yes nothing else is on the world only the Bridge
no need for a plugin
use Advanced Slime World Manager
i use it for all my minigames and lobbies
nono if a Round finished, the 'Bridge' gets resetted thats what i want
Well, it still has the same effect
yeah, advanced slime world manager + readonly world will work
By not saving the state it will revert to the old state
Alternatively you can store all the blocks in an arraylist and remove the blocks, but what's the fun in that?
I know what it is dummy
Sorry
Why can't you store all placed blocks to an arraylist?
Thats a good idea
xD
mfw not listening to my solution
Didnt saw it sorry
So, i'll add every block to a ArrayList and remove every block from the world, and add the ArrayList in?
?
But how do i add the Blocks?
for(Block b : ???)
Or world.getBlock
^^^
Pattern pattern = Pattern.compile("\\w*(?<!\\\\)BLACK");
Matcher matcher = pattern.matcher("test BLACK");
if(matcher.find()) {
System.out.println("Match found");
} else {
System.out.println("Match not found");
}```
I got it, but thanks so much anyway.
wanna know what else is smart
SOOO SMART
yee
use a world manager instead? https://github.com/Paul19988/Advanced-Slime-World-Manager
i could nuke my lobby server and after a restart or reload via a plugin its as good as new
something you probably are looking for
Is there any Tutorial? Or any Tutorial Code? I dont find a Tutorial online
Only how to install
im dumb
a bit of reading https://github.com/Paul19988/Advanced-Slime-World-Manager/blob/develop/.docs/api/setup-dev.md
is there a way to make the plugin add a datapack
does anyone here use mac?
are you still stuck installing maven?
@eternal oxide wait, why does my regex match ermRED for something like ermREDhuh...
why not only RED?
no something else
which IS spigot related
because you asked for a word
?
all attached characters count as the word
you want to to ONLY match that soecific patern?
I'm not very familiar with regexes
I want to only match GREEN if it's something like heyGREENhello
but not match it if it is hey\GREENhello
replace the w with b
are you trying to replace words with colours?
yep
then do a pattern match on a delimited list
I can show you the code, hold on
public String colorSupporterMessage(String msg){
for(ChatColor c : ccList){
if(!c.equals(ChatColor.RESET)){
msg = msg.replaceAll("\\b*(?<!\\\\)" + c.name(), c + "");
msg = msg.replaceAll("\\b*(?<!\\\\)!" + colorShortcuts.get(c), c + "");
}
}
msg = msg.replaceAll("\\", "");
return msg;
}```
ccList is a list of all the ChatColors
theres a simpler way I think. sec
obfuscation in free plugins is prohibited?
not prophited, but strongly discouraged
by the community
you should also take a look at the obfuscation rules
I mean are you trying to hide something or what
if (e.getView().getTitle().contains("Creative Gui Other")) {
final ItemStack targetHead = e.getClickedInventory().getItem(10);
final String targetName = ChatColor.stripColor(targetHead.getItemMeta().getDisplayName());
if (e.getCurrentItem().getItemMeta() != null && e.getCurrentItem().getItemMeta().getDisplayName() != null) {
switch (e.getSlot()) {
case 0:
e.setCancelled(true);
break;
case 1:
e.getWhoClicked().sendMessage(Utilities.color(Prefix + " " + "&b You Are Now in Survival!"));
targetName.set
e.setCancelled(true);
break;
,paste
no, I found an obfuscate plugin
what event could i use in 1.8 for a player entering water like in sumo duels
when the player fall into the water the player die is my end result and what is the event for this?
im home now
Yours is probably the best. I can match it with a delimited list but its not as easy to replace the result.
get teh lore of the clicked item
how
or I think you put the name in teh GUI title, so get the name from there
@eternal oxide and what is with my problem?
you already know how to get Lore. You set it when you created your GUI
I don;t support 1.8. Too old
okay but every pvp server is on it
what event could i use in 1.8 for a player entering water like in sumo duels when the player fall into the water the player die is my end result and what is the event for this?
around 8% of servers run 1.8
no... pvp servers are running 1.8
and also hypixel
anyways i need a sulution
- solution
He said it plural. He wasn't describing just 'pvp' servers. Just CTRL + F and look if others had your problem.
no there is noone
It's also probably Entity collision. They usually have custom arenas.
So if you get the y level underneath the map and set it to where water is you could probably do whatever you plan on doing.
You could check the PlayerMoveEvent. Monitor when the getFrom() and GetTo() getBlockY() changes. getTo().getBlock().getType() == Material.WATER
^
okay
I joined a server and noticed that when you type a command "/help" for example, the text when you are typing it shows up as blue instead of the usual gray, how is this achieved?
Probably brigadier
how do I use it?
Only god can help you with that
when i pull the name off the head i cant get target name to work with the targetname.setgamemode(Gamemode.Creatine);
ity comes up in red
creatine
you have to get teh player with the name
What do you mean?
i use brigad for commands but i dont think you can change the color with it
or in the api at least
Whats brigadier?
Ill grab a screenshot from the server
@eternal oxide but the == does not work just .equals()
no Material is an == comparison
hmm
if(event.getTo().getBlock().getType().equals(Material.WATER)) {
if(event.getFrom().getBlock().getType().equals(Material.WATER)) {
}
I missed () off getType()
mojang's command framework
nope, not .equals. It shoudl be ==
and thast wrong
== can be used for enums as they are singletons, .equals() is slightly slower and is not null-safe
if(event.getTo().getBlock().getType() == Material.WATER) {
if(event.getFrom().getBlock().getType() == Material.WATER) {
}
like this it is red
underlined
@paper viper @fathom timber
Your IDE says why
Well, aqua. But isn't that default behaviour?
in brigadier
default would be red or gray
if (event.getFrom().getBlockY() != event.getTo().getBlockY()) {
if (event.getTo().getBlock().getType() == Material.WATER) {```
red for an unknown command and gray for a known command i think
If the command is parseable I think it's aqua
or white
well here
it doesnt matter what text I enter, it is blue
now forgive me if I am wrong, but I dont think adhiuahsiudhaihds is parsable
^ that is my server
gray vs aqua
That probably means that some plugin is intercepting the command completion
am I gonna get in trouble for advertising or something?
true
i think its fine
i mean he isnt shoving it into our face
or chatting the links directly
Yeah he had a reason
But if they didn't read the context of his issue they could've seen it wrong
but anyway, I have been trying to change the color of that for days now and there are ZERO answers anywhere
I could try using Denizen but im not sure if its capable of that
It's not documented interface
Havent really tried any others
i suspect its some intercepted packet
Wiki vg lists nothing that could do that
to be fair, even hypixel uses gray and red
but idk that aqua looks so good for some reason, I just really want it haha
Gotta hire a full graphic designer for colors
Lol
found the message
Noice
not possible within api
It is what it is @glass pike sorry. I'd just stick with what you know
word
so how do i fix this
Why do some people do:
//
//
//
//
//
Instead of
*/
/*
idek
I see it so often
because that is what IJ does when you ctrl + /
oh fr weird
Lol
I did the wrong args sorry I did */
As I told you that is just a name, you need to get teh player for that name.
teh gang
Player player = player sender or sender player 🤔
bukkit getPlayer
I haven't done development for mc in like 1 month
What does != do again
._.
(Player) sender
Oh lol
I've been doing to much rust shit
Just to get the entity that killed the player
Tf does that even do????
Dude its deadass like that
var attacker = info?.InitiatorPlayer;
if (attacker == null)
return;
//From here on we have attacker
``` @PulseBeat_02#9425
How tf did that not mention you👀
??????????????????????
public class Core extends JavaPlugin implements Listener {
@Override
public void onEnable() {
this.getServer().getPluginManager().registerEvents(this, this);
}
@EventHandler
public void onInventoryClick(InventoryClickEvent event) {
if (!(event.getCursor()).getItemMeta().hasEnchant(Enchantment.VANISHING_CURSE)) {
if ((event.getCursor()).getItemMeta().getEnchantLevel(Enchantment.DURABILITY) >= 10) {
event.getCursor().getItemMeta().addEnchant(Enchantment.VANISHING_CURSE, 1, true);
}
}
}
} ```
this is my first plugin
i know java though
lmao
not sure why its null
what is a simple plugin that adds /r as in /reply to 16.5
though jake I'm surprised someone uses Plugin#getServer as opposed to just the Bukkit class so I like you now ok 🙂
Essentials mb
no clue im new to spigot plugin development so i just googled how to add an enchanment
https://github.com/lucko/helper
it should be working but for some reason its giving me this
i assume its the level
Like do you have pm already?
Like /pm (target)
just normal spigot mc
Ik
this
lol
probably
ive inherited a server
and essentials sucks
but the server depends on it
and the old owner couldnt code
so he just pasted random ass plugins
how do you add it as a dependency, and yes it should work
maven
@crude charm
There is no no args subscribe method
Remove that line of code then build your app
wdym
And besides make sure to build after adding a dependency
Zoi you have to pass what type of Event by its class I think
you need to pass an event class
and then maybe some consumer or smtng
@ivory sleet
I don't see any Subscribe option anyways 🤷 https://github.com/lucko/helper/wiki
Even then I'm on mobile so I can't see much
Events.subscribe(PlayerJoinEvent.class).handler(e -> e.setJoinMessage(""));
example tho
PlayerJoinEvent**.class**
https://github.com/lucko/helper/wiki/helper:-Events @fathom timber
Ohhh
ive read it like 10 times
Did you put .class
I literally marked it bold jfc lol
whats the error
Did you import what it asked and that too^
Prob has to be in a method
that isnt even loading for me