Skip to content

Commit

Permalink
Merge pull request #70 from NomNuggetNom/nom
Browse files Browse the repository at this point in the history
v2.0.3b
  • Loading branch information
NomNuggetNom committed Nov 16, 2014
2 parents cdce56c + cc2b83c commit 09245e1
Show file tree
Hide file tree
Showing 11 changed files with 605 additions and 35 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@

| Main | Beta |
------------- | ------------- | ------------ |
Mod | N/A | 2.0 |
Forge | N/A | [10.13.0.1180](http://files.minecraftforge.net/maven/net/minecraftforge/forge/1.7.10-10.13.0.1180/forge-1.7.10-10.13.0.1180-installer.jar) |
Minecraft | N/A | 1.7.10 |
Mod | 2.0.2 | 2.0.3 |
Forge | [10.13.0.1180](http://files.minecraftforge.net/maven/net/minecraftforge/forge/1.7.10-10.13.0.1180/forge-1.7.10-10.13.0.1180-installer.jar) | [10.13.0.1180](http://files.minecraftforge.net/maven/net/minecraftforge/forge/1.7.10-10.13.0.1180/forge-1.7.10-10.13.0.1180-installer.jar) |
Minecraft | 1.7.10 | 1.7.10 |

#### Install

Expand Down
6 changes: 3 additions & 3 deletions src/main/java/us/mcpvpmod/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -44,15 +44,15 @@ public class Main {
/** The name of the mod is displayed on the configuration screen. */
public static final String name = "MCPVP Mod";
/** The version of the mod. */
public static final String modVersion = "2.0.2";
public static final String modVersion = "2.0.3";
/** The version of MC that the mod was compiled for. */
public static final String mcVersion = "1.7.10";
/** The version of Forge that the mod was compiled for. */
public static final String forgeVersion = "10.13.0.1180";
/** A reference to the GuiFactory. Necessary for loading the configuration screen. */
public static final String guiFactory = "us.mcpvpmod.config.GuiFactory";
/** Whether or not this mod is a beta release. */
public static final boolean isBeta = false;
public static final boolean isBeta = true;

@Instance
/** Used by Forge to recognize this as a Forge mod. */
Expand Down Expand Up @@ -80,7 +80,7 @@ public class Main {
public static InfoBlock friendsList = null;

@EventHandler
public void preInit(@SuppressWarnings("unused") FMLPreInitializationEvent e) {
public void preInit(@SuppressWarnings("unused") FMLPreInitializationEvent e) {
Main.l(Format.s("startup"));

// Register all events in the Events class.
Expand Down
15 changes: 11 additions & 4 deletions src/main/java/us/mcpvpmod/events/chat/AllChat.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package us.mcpvpmod.events.chat;

import net.minecraft.util.ChatComponentText;
import net.minecraft.util.ChatStyle;
import net.minecraftforge.client.event.ClientChatReceivedEvent;
import us.mcpvpmod.Main;
import us.mcpvpmod.Server;
Expand Down Expand Up @@ -29,15 +30,15 @@ public class AllChat {
*/
public static void handleChat(ClientChatReceivedEvent event) {
String message = event.message.getUnformattedText();

AllJoin.showWelcome();
IgnoreResult.checkAll(event);

if (message.matches(rePing)) {
AllVars.vars.put("ping", message.replaceAll(rePing, "$1"));
}

//FMLLog.info("message: \"%s\"", message);
Main.l("message: \"%s\"", event.message.getFormattedText());
if (message.equals(msgLogged)) {
Server.onJoin(Main.mc.func_147104_D().serverIP);
//HandleJoinMCPVP.onJoin();
Expand All @@ -52,8 +53,10 @@ public static void handleChat(ClientChatReceivedEvent event) {
return;
}

// Censor chat.
event.message = new ChatComponentText(censorChat(event.message.getFormattedText().replaceAll("§", "\u00A7")));
// Censor chat.
ChatStyle old = event.message.getChatStyle();
event.message = new ChatComponentText(censorChat(event.message.getFormattedText()));
event.message.setChatStyle(old);

if (message.matches(reIP)) {
ServerHelper.currentIP = message.replaceAll(reIP, "$1");
Expand Down Expand Up @@ -103,6 +106,10 @@ public static boolean removeChat(String message) {
public static String censorChat(String message) {
String text = message;
for (String string : ConfigChat.filterWords) {

// <3
if (string.equals("toot") && message.contains("redmantooth")) continue;

// Use (?i) to ignore case. A little bit hacky.
text = text.replaceAll("(?i)" + string, "*****");
}
Expand Down
3 changes: 3 additions & 0 deletions src/main/java/us/mcpvpmod/events/join/AllJoin.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import us.mcpvpmod.game.vars.VarsRaid;
import us.mcpvpmod.game.vars.VarsSab;
import us.mcpvpmod.gui.tutorial.Tutorial;
import us.mcpvpmod.html.HTMLStats;
import us.mcpvpmod.util.Data;

public class AllJoin {
Expand Down Expand Up @@ -43,6 +44,8 @@ public static void onJoin() {

// Clear the second chat.
Main.secondChat.clearChatMessages();

new HTMLStats("NomNuggetNom").establish(true);
}

/**
Expand Down
26 changes: 23 additions & 3 deletions src/main/java/us/mcpvpmod/game/vars/AllVars.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,13 @@
import us.mcpvpmod.game.info.AllInfo;

/**
* Variables for every server.
* @author NomNuggetNom
* Variables for every server. Used in processing
* an {@link InfoBlock}, whereas {@link Vars} are
* not. In an {@link InfoBlock}, usage of <code>{var_name}</code>
* is translated into a direct calling of {@link #get(String)} where
* the argument is <code>var_name</code>. Identical calls are performed
* in the server-dependent variable class if null is returned
* from this class.
*/
public class AllVars {

Expand All @@ -22,15 +27,30 @@ public static void putVars() {
vars.put("y", "" + AllInfo.getY());
vars.put("z", "" + AllInfo.getZ());
vars.put("ip", AllInfo.getIP());
vars.put("short ip", ServerHelper.shortServerIP());
vars.put("short ip", AllVars.get("short-ip"));
vars.put("short-ip", ServerHelper.shortServerIP());
vars.put("short_ip", ServerHelper.shortServerIP());
vars.put("s-ip", ServerHelper.shortServerIP());
vars.put("s_ip", ServerHelper.shortServerIP());
vars.put("sip", ServerHelper.shortServerIP());
vars.put("fps", Main.mc.debug.split(",")[0].replaceAll("fps", ""));
vars.put("direction", AllInfo.getDirection());
vars.put("dir", "" + AllInfo.getDirectionChar());
vars.put("f", "" + AllInfo.getF());
vars.put("f.", "" + AllInfo.getF());
vars.put("fdec", "" + AllInfo.getFDecimal());
vars.put("players", "" + AllInfo.getPlayersOnline());
}

/**
* Puts a value into the variable storage.
* @param key The key of the value.
* @param value The value.
*/
public static void put(String key, String value) {
vars.put(key, value);
}

/**
* Used to get variables. Avoids returning null.
* @param string The key of the variable to get.
Expand Down
7 changes: 7 additions & 0 deletions src/main/java/us/mcpvpmod/game/vars/Vars.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,13 @@

import us.mcpvpmod.Main;

/**
* General purpose variables that are assigned
* via: {@link ChatTrigger}, {@link ChatTracker},
* and other such utilities. Differ from {@link AllVars} in
* that they are not considered when processing an {@link InfoBlock}.
* The only visible use of these variables is in a {@link CustomAlert}.
*/
public class Vars {

public static HashMap<String, String> vars = new HashMap<String, String>();
Expand Down
9 changes: 8 additions & 1 deletion src/main/java/us/mcpvpmod/gui/InfoBlock.java
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public class InfoBlock extends Selectable {
* Could be DummyState.NONE, which is rendered in all States. */
private final State state;
/** The Server to render the block in.
* Could be Server.ALL, which is rendered in all Servers. */
* Could be {@link Server#ALL}, which is rendered in all Servers. */
private final Server server;
/** The starting X coordinate. */
private int baseX;
Expand Down Expand Up @@ -467,6 +467,13 @@ public String getTitle() {
return title;
}

/**
* @param toDisplay the toDisplay to set
*/
public void setToDisplay(ArrayList<String> toDisplay) {
this.toDisplay = toDisplay;
}

@Override
public void outline() {

Expand Down
Loading

0 comments on commit 09245e1

Please sign in to comment.