Skip to content

Commit 32e023b

Browse files
author
Kyzderp
committed
Fixed up user message formats and bugs
1 parent 5bd2387 commit 32e023b

File tree

4 files changed

+41
-30
lines changed

4 files changed

+41
-30
lines changed

Diff for: ant/build_examplemod.xml

+2-2
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,11 @@
1313
<!-- The file is well commented and you should have a read through this script before making -->
1414
<!-- changes to ensure that you know how it works. -->
1515

16-
<project name="mobcounter_staff" basedir="." default="main">
16+
<project name="mobcounter" basedir="." default="main">
1717

1818
<!-- The version of your mod, can be any string as long as it's valid as part of a file name -->
1919
<!-- and should match the version string returned by your mod. -->
20-
<property name="version" value="1.1.0" />
20+
<property name="version" value="1.1.1" />
2121

2222
<!-- The Minecraft version the mod is for, appended to the output file name for reference -->
2323
<property name="mcversion" value="1.7.2" />

Diff for: ant/buildnumber.txt

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
#Build Number for ANT. Do not edit!
2-
#Wed Mar 25 02:56:48 PDT 2015
3-
build.number=38
2+
#Sat Apr 04 05:06:49 PDT 2015
3+
build.number=39
-67 Bytes
Binary file not shown.

Diff for: java/com/kyzeragon/mobcountmod/LiteModMobCounter.java

+37-26
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
@ExposableOptions(strategy = ConfigStrategy.Versioned, filename="mobcountermod.json")
3232
public class LiteModMobCounter implements Tickable, ChatFilter, OutboundChatListener
3333
{
34-
private static final boolean staff = true;
34+
private static final boolean staff = false;
3535
private static final boolean useOptions = false;
3636
private static final boolean rebel = false;
3737
private static KeyBinding counterKeyBinding;
@@ -70,7 +70,7 @@ else if (this.staff)
7070
}
7171

7272
@Override
73-
public String getVersion() { return "1.1.0"; }
73+
public String getVersion() { return "1.1.1"; }
7474

7575
@Override
7676
public void init(File configPath)
@@ -144,54 +144,59 @@ public void onTick(Minecraft minecraft, float partialTicks, boolean inGame, bool
144144
/**
145145
* Client side commands
146146
*/
147+
@SuppressWarnings("unused")
147148
@Override
148149
public void onSendChatMessage(C01PacketChatMessage packet, String message)
149150
{
150151
String[] tokens = message.split(" ");
151-
if (tokens[0].equalsIgnoreCase("/counter") || tokens[0].equalsIgnoreCase("/count"))
152+
if (tokens[0].equalsIgnoreCase("/counter"))
152153
{
153154
this.sentCmd = true;
154155
if (tokens.length < 2)
155156
{
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);
158159
return;
159160
}
160161
if (tokens[1].equalsIgnoreCase("message") || tokens[1].equalsIgnoreCase("m")
161162
|| tokens[1].equalsIgnoreCase("msg"))
162163
{
163164
if (tokens.length < 3)
164165
{
166+
if (this.toMessage == null)
167+
{
168+
this.logMessage("Not currently notifying any players.", true);
169+
return;
170+
}
165171
String toSend = "Currently notifying: ";
166172
for (String name : this.toMessage)
167173
toSend += name + " ";
168-
this.logMessage(toSend);
174+
this.logMessage(toSend, true);
169175
}
170176
else if (tokens.length > 3)
171177
this.logError("Too many args! Usage: /counter msg clear OR /counter msg [player1[,player2]]]");
172178
else if (tokens[2].equalsIgnoreCase("clear"))
173179
{
174180
this.toMessage = null;
175-
this.logMessage("Not currently notifying any players.");
181+
this.logMessage("Not currently notifying any players.", true);
176182
}
177183
else
178184
{
179185
this.toMessage = tokens[2].split(",");
180186
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);
183188
}
184189
}
185190
else if (tokens[1].equalsIgnoreCase("sound"))
186191
{
187192
if (tokens.length < 3)
188-
this.logMessage("Current hostile sound: " + this.sound);
193+
this.logMessage("Current hostile sound: " + this.sound, true);
189194
else if (tokens.length > 3)
190195
this.logError("Too many args! Usage: /counter sound <sound file>");
191196
else
192197
{
193198
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);
195200
}
196201
}
197202
else if (tokens[1].matches("fac|faction"))
@@ -201,16 +206,20 @@ else if (tokens[1].matches("fac|faction"))
201206
if (tokens[2].equalsIgnoreCase("on"))
202207
{
203208
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);
205210
}
206211
else if (tokens[2].equalsIgnoreCase("off"))
207212
{
208213
this.notifyFac = false;
209-
this.logMessage("Not notifying in faction chat.");
214+
this.logMessage("Not notifying in faction chat.", true);
210215
}
211216
else
212217
this.logError("Usage: /counter fac <on|off>");
213218
}
219+
else if (this.notifyFac)
220+
this.logMessage("Currently notifying faction chat.", true);
221+
else
222+
this.logMessage("Currently not notifying faction chat.", true);
214223
}
215224
else if (tokens[1].equalsIgnoreCase("xp5") && this.staff)
216225
{
@@ -219,32 +228,32 @@ else if (tokens[1].equalsIgnoreCase("xp5") && this.staff)
219228
if (tokens[2].equalsIgnoreCase("on"))
220229
{
221230
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);
223232
return;
224233
}
225234
else if (tokens[2].equalsIgnoreCase("off"))
226235
{
227236
this.counter.setXP5(false);
228-
this.logMessage("Using normal mob counter radius.");
237+
this.logMessage("Using normal mob counter radius.", true);
229238
return;
230239
}
231240
}
232241
this.logError("Usage: /sd xp5 <on|off>");
233242
}
234243
else if (tokens[1].equalsIgnoreCase("help"))
235244
{
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);
242251
for (String command : commands)
243-
this.logMessage("/counter " + command);
252+
this.logMessage("/counter " + command, false);
244253
}
245254
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);
248257
}
249258
}
250259
}
@@ -445,10 +454,12 @@ private void displayHostile()
445454
* Logs the message to the user
446455
* @param message The message to log
447456
*/
448-
public static void logMessage(String message)
457+
public static void logMessage(String message, boolean usePrefix)
449458
{
459+
if (usePrefix)
460+
message = "§8[§2MobCounter§8] §a" + message;
450461
ChatComponentText displayMessage = new ChatComponentText(message);
451-
displayMessage.setChatStyle((new ChatStyle()).setColor(EnumChatFormatting.AQUA));
462+
displayMessage.setChatStyle((new ChatStyle()).setColor(EnumChatFormatting.GREEN));
452463
Minecraft.getMinecraft().thePlayer.addChatComponentMessage(displayMessage);
453464
}
454465

0 commit comments

Comments
 (0)