31
31
@ ExposableOptions (strategy = ConfigStrategy .Versioned , filename ="mobcountermod.json" )
32
32
public class LiteModMobCounter implements Tickable , ChatFilter , OutboundChatListener
33
33
{
34
- private static final boolean staff = true ;
34
+ private static final boolean staff = false ;
35
35
private static final boolean useOptions = false ;
36
36
private static final boolean rebel = false ;
37
37
private static KeyBinding counterKeyBinding ;
@@ -70,7 +70,7 @@ else if (this.staff)
70
70
}
71
71
72
72
@ Override
73
- public String getVersion () { return "1.1.0 " ; }
73
+ public String getVersion () { return "1.1.1 " ; }
74
74
75
75
@ Override
76
76
public void init (File configPath )
@@ -144,54 +144,59 @@ public void onTick(Minecraft minecraft, float partialTicks, boolean inGame, bool
144
144
/**
145
145
* Client side commands
146
146
*/
147
+ @ SuppressWarnings ("unused" )
147
148
@ Override
148
149
public void onSendChatMessage (C01PacketChatMessage packet , String message )
149
150
{
150
151
String [] tokens = message .split (" " );
151
- if (tokens [0 ].equalsIgnoreCase ("/counter" ) || tokens [ 0 ]. equalsIgnoreCase ( "/count" ) )
152
+ if (tokens [0 ].equalsIgnoreCase ("/counter" ))
152
153
{
153
154
this .sentCmd = true ;
154
155
if (tokens .length < 2 )
155
156
{
156
- this .logMessage (this .getName () + " [v " + this .getVersion () + "] by Kyzeragon" );
157
- this .logMessage ("Type /counter help for commands." );
157
+ this .logMessage ("§2" + this .getName () + " §8[§2v " + this .getVersion () + "§8] §aby Kyzeragon" , false );
158
+ this .logMessage ("Type §2 /counter help §afor commands." , false );
158
159
return ;
159
160
}
160
161
if (tokens [1 ].equalsIgnoreCase ("message" ) || tokens [1 ].equalsIgnoreCase ("m" )
161
162
|| tokens [1 ].equalsIgnoreCase ("msg" ))
162
163
{
163
164
if (tokens .length < 3 )
164
165
{
166
+ if (this .toMessage == null )
167
+ {
168
+ this .logMessage ("Not currently notifying any players." , true );
169
+ return ;
170
+ }
165
171
String toSend = "Currently notifying: " ;
166
172
for (String name : this .toMessage )
167
173
toSend += name + " " ;
168
- this .logMessage (toSend );
174
+ this .logMessage (toSend , true );
169
175
}
170
176
else if (tokens .length > 3 )
171
177
this .logError ("Too many args! Usage: /counter msg clear OR /counter msg [player1[,player2]]]" );
172
178
else if (tokens [2 ].equalsIgnoreCase ("clear" ))
173
179
{
174
180
this .toMessage = null ;
175
- this .logMessage ("Not currently notifying any players." );
181
+ this .logMessage ("Not currently notifying any players." , true );
176
182
}
177
183
else
178
184
{
179
185
this .toMessage = tokens [2 ].split ("," );
180
186
String toSend = tokens [2 ].replaceAll ("," , " " );
181
- this .logMessage ("Now notifying: " + toSend );
182
- this .logError ("Usage: /counter msg clear OR /counter msg <player[,player2]>" );
187
+ this .logMessage ("Now notifying: " + toSend , true );
183
188
}
184
189
}
185
190
else if (tokens [1 ].equalsIgnoreCase ("sound" ))
186
191
{
187
192
if (tokens .length < 3 )
188
- this .logMessage ("Current hostile sound: " + this .sound );
193
+ this .logMessage ("Current hostile sound: " + this .sound , true );
189
194
else if (tokens .length > 3 )
190
195
this .logError ("Too many args! Usage: /counter sound <sound file>" );
191
196
else
192
197
{
193
198
this .sound = tokens [2 ];
194
- this .logMessage ("Now using " + this .sound + " as notification sound." );
199
+ this .logMessage ("Now using " + this .sound + " as notification sound." , true );
195
200
}
196
201
}
197
202
else if (tokens [1 ].matches ("fac|faction" ))
@@ -201,16 +206,20 @@ else if (tokens[1].matches("fac|faction"))
201
206
if (tokens [2 ].equalsIgnoreCase ("on" ))
202
207
{
203
208
this .notifyFac = true ;
204
- this .logMessage ("Now notifying in faction chat when over 150 mobs." );
209
+ this .logMessage ("Now notifying in faction chat when over 150 mobs." , true );
205
210
}
206
211
else if (tokens [2 ].equalsIgnoreCase ("off" ))
207
212
{
208
213
this .notifyFac = false ;
209
- this .logMessage ("Not notifying in faction chat." );
214
+ this .logMessage ("Not notifying in faction chat." , true );
210
215
}
211
216
else
212
217
this .logError ("Usage: /counter fac <on|off>" );
213
218
}
219
+ else if (this .notifyFac )
220
+ this .logMessage ("Currently notifying faction chat." , true );
221
+ else
222
+ this .logMessage ("Currently not notifying faction chat." , true );
214
223
}
215
224
else if (tokens [1 ].equalsIgnoreCase ("xp5" ) && this .staff )
216
225
{
@@ -219,32 +228,32 @@ else if (tokens[1].equalsIgnoreCase("xp5") && this.staff)
219
228
if (tokens [2 ].equalsIgnoreCase ("on" ))
220
229
{
221
230
this .counter .setXP5 (true );
222
- this .logMessage ("Now counting only mobs at ShockerzXP5 kill points... mostly." );
231
+ this .logMessage ("Now counting only mobs at ShockerzXP5 kill points... mostly." , true );
223
232
return ;
224
233
}
225
234
else if (tokens [2 ].equalsIgnoreCase ("off" ))
226
235
{
227
236
this .counter .setXP5 (false );
228
- this .logMessage ("Using normal mob counter radius." );
237
+ this .logMessage ("Using normal mob counter radius." , true );
229
238
return ;
230
239
}
231
240
}
232
241
this .logError ("Usage: /sd xp5 <on|off>" );
233
242
}
234
243
else if (tokens [1 ].equalsIgnoreCase ("help" ))
235
244
{
236
- String [] commands = {"msg [player1[,player2]] - Set notified players" ,
237
- "msg clear - Clear the list of notfied players" ,
238
- "fac|faction <on|off> - Toggle notification in faction chat." ,
239
- "sound [sound file] - Set the notification sound." ,
240
- "help - This help message. Hurrdurr." };
241
- this .logMessage (this .getName () + " [v " + this .getVersion () + "] commands" );
245
+ String [] commands = {"msg [player1[,player2]] §7- §aSet notified players" ,
246
+ "msg clear §7- §aClear the list of notfied players" ,
247
+ "fac|faction <on|off> §7- §aToggle notification in faction chat." ,
248
+ "sound [sound file] §7- §aSet the notification sound." ,
249
+ "help §7- §aThis help message. Hurrdurr." };
250
+ this .logMessage ("§2" + this .getName () + " §8[§2v " + this .getVersion () + "§8] §acommands" , false );
242
251
for (String command : commands )
243
- this .logMessage ("/counter " + command );
252
+ this .logMessage ("/counter " + command , false );
244
253
}
245
254
else {
246
- this .logMessage (this .getName () + " [v" + this .getVersion () + "]" );
247
- this .logMessage ("Type /counter help for commands." );
255
+ this .logMessage (this .getName () + " [v" + this .getVersion () + "]" , false );
256
+ this .logMessage ("Type /counter help for commands." , false );
248
257
}
249
258
}
250
259
}
@@ -445,10 +454,12 @@ private void displayHostile()
445
454
* Logs the message to the user
446
455
* @param message The message to log
447
456
*/
448
- public static void logMessage (String message )
457
+ public static void logMessage (String message , boolean usePrefix )
449
458
{
459
+ if (usePrefix )
460
+ message = "§8[§2MobCounter§8] §a" + message ;
450
461
ChatComponentText displayMessage = new ChatComponentText (message );
451
- displayMessage .setChatStyle ((new ChatStyle ()).setColor (EnumChatFormatting .AQUA ));
462
+ displayMessage .setChatStyle ((new ChatStyle ()).setColor (EnumChatFormatting .GREEN ));
452
463
Minecraft .getMinecraft ().thePlayer .addChatComponentMessage (displayMessage );
453
464
}
454
465
0 commit comments