Skip to content

Commit c3443d9

Browse files
author
Jeremy
committed
New command /mmotd player
Now can get the player motd from new command, cool when your staff and want to check
1 parent 1e1f8a1 commit c3443d9

File tree

2 files changed

+59
-5
lines changed

2 files changed

+59
-5
lines changed

config.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
Enable: true
2-
2+
33
Message:
4-
IsPlayer: "--\nThis &dis \n&aAn &6Exemple \nof &5a &8custom \n&cMOTD &afor &4PLAYER!\n--"
5-
IsStaff: "--\nThis &dis \n&aAn &6Exemple \nof &5a &8custom \n&cMOTD &afor &4Staff!\n--"
4+
IsPlayer: "-------\n[&aMessage of the Day&f]\n* &6New spawn!\n* &6New minigame!\n* &cNo more double jump!\n~ Have a great day on our server ~\n-------"
5+
IsStaff: "-------\n[&4STAFF To-Do List&f]\n* &6Update\n- PlayerTag plugin\n* &cRemove\n- CreativeWorld\n- AmusementParkWorld\n* &aAdd\n- AntiCheat Plugin\n-------"

src/fr/MrJeje_/ManyMOTD/LesCommandes.java

Lines changed: 56 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package fr.MrJeje_.ManyMOTD;
22

3+
import org.bukkit.Bukkit;
34
import org.bukkit.command.Command;
45
import org.bukkit.command.CommandExecutor;
56
import org.bukkit.command.CommandSender;
@@ -10,6 +11,7 @@ public class LesCommandes implements CommandExecutor {
1011

1112
private ManyMOTD pl;
1213
private FileConfiguration config;
14+
private String Error = "§4[Error!] Your command is wrong, please refer to /mmotd help";
1315

1416
public LesCommandes(ManyMOTD ManyMOTD) {
1517
this.pl = ManyMOTD;
@@ -45,8 +47,60 @@ public boolean onCommand(CommandSender sender, Command cmd, String msg, String[]
4547

4648
}
4749

48-
if(args.length > 0){
49-
p.sendMessage("ManyMOTD developed by §4§lMrJeje_");
50+
if(args.length == 1){ //1 argument
51+
52+
if(args[0].equalsIgnoreCase("player")){
53+
String message = config.getString("Message.IsPlayer").replace("&", "§");
54+
String[] messageSplit = message.split("\n");
55+
p.sendMessage(messageSplit);
56+
}
57+
58+
else if(args[0].equalsIgnoreCase("help")){
59+
p.sendMessage(
60+
"§e§l--- §fManyMOTD Help §e§l---"
61+
+ "\n§7Below is a list of all MMOTD commands:§f"
62+
+ "\n§6/mmotd: Show the current MOTD base on your rank"
63+
+ "\n§6/mmotd player: Show the player MOTD"
64+
+ "\n§6/mmotd help: Give you a list of ManyMOTD commands"
65+
+ "\n§7(ManyMOTD developed by MrJeje_)"
66+
+ "\n§e§l----"
67+
);
68+
}
69+
70+
else{
71+
p.sendMessage(Error);
72+
}
73+
}
74+
/*
75+
if(args.length == 2){//2 argument
76+
p.sendMessage(config.getString("Message.ErrorCommand").replace("&", "§"));
77+
}
78+
if(args.length == 3){ //3 argument
79+
80+
if(args[0].equalsIgnoreCase("set")){
81+
String rank = args[1];
82+
String NewMOTD = args[2];
83+
84+
if((rank.equalsIgnoreCase("Player"))||(rank.equalsIgnoreCase("Staff"))){
85+
pl.getConfig().set("Message.Is"+rank, NewMOTD);
86+
p.sendMessage("New MOTD for "+rank+" just applied!");
87+
}
88+
else{
89+
p.sendMessage("§4Rank inscrit: "+rank);
90+
p.sendMessage("§MOTD inscrit: "+NewMOTD);
91+
p.sendMessage("§4Nom du rank incorrect!");
92+
}
93+
94+
}
95+
96+
else{
97+
p.sendMessage(config.getString("Message.ErrorCommand").replace("&", "§"));
98+
}
99+
}
100+
*/
101+
102+
if(args.length >= 2){
103+
p.sendMessage(Error);
50104
}
51105
}
52106
}

0 commit comments

Comments
 (0)