Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Forge and change ChatBox message format #163

Open
wants to merge 5 commits into
base: 1.8.9
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
PeripheralsPlusPlus [![Build Status](https://drone.io/github.com/austinv11/PeripheralsPlusPlus/status.png)](https://drone.io/github.com/austinv11/PeripheralsPlusPlus/files)
PeripheralsPlusPlus [![Build Status](https://drone.io/github.com/justync7/PeripheralsPlusPlus/status.png)](https://drone.io/github.com/austinv11/PeripheralsPlusPlus/files)
===================

![Logo](http://puu.sh/fB9TB/66231fda96.png)
Expand Down
6 changes: 3 additions & 3 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -22,18 +22,18 @@ plugins {
*/
version = "1.4.0"
group= "com.austinv11.peripheralsplusplus" // http://maven.apache.org/guides/mini/guide-naming-conventions.html
archivesBaseName = "Peripherals++"
archivesBaseName = "Peripherals++" + mcversion

minecraft {
version = "1.8.9-11.15.1.1755"
version = "1.8.9-11.15.1.1902-1.8.9"
runDir = "run"

// the mappings can be changed at any time, and must be in the following format.
// snapshot_YYYYMMDD snapshot are built nightly.
// stable_# stables are built at the discretion of the MCP team.
// Use non-default mappings at your own risk. they may not allways work.
// simply re-run your setup task after changing the mappings to update your workspace.
mappings = "stable_20"
mappings = "stable_22"
// makeObfSourceJar = false // an Srg named sources jar is made by default. uncomment this to disable.
}

Expand Down
1 change: 1 addition & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
mcversion = "1.8.9"
4 changes: 2 additions & 2 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#Mon Sep 14 12:28:28 PDT 2015
#Sat Jul 02 04:03:50 CDT 2016
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-2.7-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-2.7-all.zip
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import net.minecraft.util.EntityDamageSource;
import net.minecraftforge.event.ServerChatEvent;
import net.minecraftforge.event.entity.living.LivingDeathEvent;
import net.minecraftforge.event.entity.living.LivingSpawnEvent;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;

import java.util.ArrayList;
Expand All @@ -36,15 +37,16 @@ public boolean say(Object[] arguments) throws LuaException {

String message = (String) arguments[0];
int range = (int) (double) (Double) arguments[1];
String label = String.format("[%d,%d,%d]", getPos().getX(), getPos().getY(), getPos().getZ());
String coords = String.format("[%d,%d,%d]", getPos().getX(), getPos().getY(), getPos().getZ());
String label = "ChatBox";

if (arguments.length > 2) {
if (!(arguments[2] instanceof String)) {
throw new LuaException("Bad argument #3. Expected string.");
}
label = (String) arguments[2];
}
sendChatMessageInRange(message, range > Config.chatBoxMaxRange ? Config.chatBoxMaxRange : range, label);
sendChatMessageInRange(message, range > Config.chatBoxMaxRange ? Config.chatBoxMaxRange : range, label, coords);
return true;
}

Expand All @@ -59,7 +61,8 @@ public boolean tell(Object[] arguments) throws LuaException {

String recipientName = (String) arguments[0];
String message = (String) arguments[1];
String label = String.format("[%d,%d,%d]", getPos().getX(), getPos().getY(), getPos().getZ());
String coords = String.format("[%d,%d,%d]", getPos().getX(), getPos().getY(), getPos().getZ());
String label = "ChatBox";

if (arguments.length > 2) {
if (!(arguments[2] instanceof String)) {
Expand All @@ -68,7 +71,7 @@ public boolean tell(Object[] arguments) throws LuaException {
label = (String) arguments[2];
}

String messageWithLabel = label + " " + message;
String messageWithLabel = coords + "[PM] " + label + ": " + message;
EntityPlayer recipient = MinecraftServer.getServer().getConfigurationManager().getPlayerByUsername(recipientName);
if (recipient != null) {
recipient.addChatMessage(new ChatComponentText(messageWithLabel));
Expand All @@ -77,8 +80,8 @@ public boolean tell(Object[] arguments) throws LuaException {
return false;
}

private void sendChatMessageInRange(String message, int range, String label) {
String messageWithLabel = label + " " + message;
private void sendChatMessageInRange(String message, int range, String label, String coords) {
String messageWithLabel = coords + " " + label + ": " + message;
List<? extends EntityPlayer> players;

if (range >= 0) {
Expand Down