aboutsummaryrefslogtreecommitdiff
path: root/src/main
diff options
context:
space:
mode:
Diffstat (limited to 'src/main')
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/party/PartyManager.java34
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/pathfinding/NodeProcessorDungeonRoom.java21
2 files changed, 41 insertions, 14 deletions
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/party/PartyManager.java b/src/main/java/kr/syeyoung/dungeonsguide/party/PartyManager.java
index 24ee1d74..4567abb2 100644
--- a/src/main/java/kr/syeyoung/dungeonsguide/party/PartyManager.java
+++ b/src/main/java/kr/syeyoung/dungeonsguide/party/PartyManager.java
@@ -161,11 +161,11 @@ public class PartyManager implements StompMessageHandler {
e.getDungeonsGuide().getStompConnection().send(new StompPayload().payload(new JSONObject().put("status", "success").put("token", token).toString()).header("destination", "/app/party.check.resp"));
}
}
- if (invitedDash > 0) {
- invitedDash++;
+ if (invitedDash == 1 || invitedDash == 3) {
chatReceivedEvent.setCanceled(true);
+ invitedDash++;
}
- if (invitedDash == 3) invitedDash = 0;
+ if (invitedDash == 4) invitedDash = 0;
} else if (str.endsWith("§ejoined the party.§r")) {
String asd = null;
for (String s : TextUtils.stripColor(str).split(" ")) {
@@ -212,6 +212,8 @@ public class PartyManager implements StompMessageHandler {
partyJoin = 2;
chatReceivedEvent.setCanceled(true);
}
+ if (invitedDash > 0) invitedDash = 3;
+ if (invitedDash > 0) chatReceivedEvent.setCanceled(true);
setPartyID(null);
} else if (TextUtils.stripColor(str).trim().isEmpty()) {
if ((checkPlayer > 0 || partyJoin > 0) && partyJoin != 100) {
@@ -223,6 +225,8 @@ public class PartyManager implements StompMessageHandler {
partyJoin = 2;
chatReceivedEvent.setCanceled(true);
}
+ if (invitedDash > 0) invitedDash = 3;
+ if (invitedDash > 0) chatReceivedEvent.setCanceled(true);
setPartyID(null);
} else if (str.startsWith("§eParty ") && str.contains(":")) {
if (checkPlayer > 0 || partyJoin > 0) {
@@ -236,6 +240,7 @@ public class PartyManager implements StompMessageHandler {
members.add(s);
}
} else if (str.equals("§cYou are not allowed to invite players.§r")) {
+ if (invitedDash > 0) invitedDash = 3;
if (invitedDash > 0) chatReceivedEvent.setCanceled(true);
canInvite = false;
allowAskToJoin = false;
@@ -243,8 +248,11 @@ public class PartyManager implements StompMessageHandler {
RichPresenceManager.INSTANCE.updatePresence();
} else if (str.equals("§cCouldn't find a player with that name!§r")) {
canInvite = true;
+ if (invitedDash > 0) invitedDash = 3;
if (invitedDash > 0) chatReceivedEvent.setCanceled(true);
} else if (str.equals("§cYou cannot invite that player since they're not online.")) {
+ if (invitedDash > 0) invitedDash = 3;
+ if (invitedDash > 0) chatReceivedEvent.setCanceled(true);
canInvite = true;
} else if (str.endsWith("§aenabled All Invite§r")) {
canInvite = true;
@@ -269,6 +277,7 @@ public class PartyManager implements StompMessageHandler {
} else {
Minecraft.getMinecraft().thePlayer.sendChatMessage("/p invite -");
invitedDash = 1;
+ break;
}
} else {
seenThings = 0;
@@ -304,6 +313,25 @@ public class PartyManager implements StompMessageHandler {
} else {
Minecraft.getMinecraft().thePlayer.sendChatMessage("/p invite -");
invitedDash = 1;
+ break;
+ }
+ } else {
+ seenThings = 0;
+ }
+ }
+ } else if (str.endsWith("§r§eto Party Member§r")) {
+ String[] thetext = TextUtils.stripColor(str).split(" ");
+ int seenThings = 0;
+ for (String s : thetext) {
+ if (s.equals("has") && seenThings == 0) seenThings = 1;
+ else if (s.equals("demoted") && seenThings == 1) seenThings = 2;
+ else if (s.equals("[")) continue;
+ else if (seenThings == 2) {
+ if (s.equals(Minecraft.getMinecraft().getSession().getUsername())) {
+ Minecraft.getMinecraft().thePlayer.sendChatMessage("/p invite -");
+ invitedDash = 1;
+ canInvite = false;
+ break;
}
} else {
seenThings = 0;
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/pathfinding/NodeProcessorDungeonRoom.java b/src/main/java/kr/syeyoung/dungeonsguide/pathfinding/NodeProcessorDungeonRoom.java
index 8c0f447c..6b07e935 100644
--- a/src/main/java/kr/syeyoung/dungeonsguide/pathfinding/NodeProcessorDungeonRoom.java
+++ b/src/main/java/kr/syeyoung/dungeonsguide/pathfinding/NodeProcessorDungeonRoom.java
@@ -1,6 +1,8 @@
package kr.syeyoung.dungeonsguide.pathfinding;
+import com.google.common.collect.Sets;
import kr.syeyoung.dungeonsguide.dungeon.roomfinder.DungeonRoom;
+import net.minecraft.block.Block;
import net.minecraft.block.state.BlockState;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.Entity;
@@ -11,6 +13,8 @@ import net.minecraft.util.EnumFacing;
import net.minecraft.util.Vec3i;
import net.minecraft.world.pathfinder.NodeProcessor;
+import java.util.Set;
+
public class NodeProcessorDungeonRoom extends NodeProcessor {
private DungeonRoom dungeonRoom;
private BlockPos sub;
@@ -109,17 +113,12 @@ public class NodeProcessorDungeonRoom extends NodeProcessor {
return i;
}
+ public static final Set<Block> allowed = Sets.newHashSet(Blocks.air, Blocks.water, Blocks.lava, Blocks.flowing_water, Blocks.flowing_lava, Blocks.vine, Blocks.ladder
+ , Blocks.standing_sign, Blocks.wall_sign, Blocks.trapdoor, Blocks.iron_trapdoor, Blocks.wooden_button, Blocks.stone_button, Blocks.fire,
+ Blocks.torch, Blocks.rail, Blocks.golden_rail, Blocks.activator_rail, Blocks.detector_rail, Blocks.carpet, Blocks.redstone_torch);
+ public static final IBlockState preBuilt = Blocks.stone.getStateFromMeta(2);
public static boolean isValidBlock(IBlockState state) {
- return state.getBlock() == Blocks.air || state.getBlock() == Blocks.water || state.getBlock() == Blocks.lava
- || state.getBlock() == Blocks.flowing_water || state.getBlock() == Blocks.flowing_lava
- || state.getBlock() == Blocks.vine || state.getBlock() == Blocks.ladder
- || state.getBlock() == Blocks.standing_sign || state.getBlock() == Blocks.wall_sign
- || state.getBlock() == Blocks.trapdoor || state.getBlock() == Blocks.iron_trapdoor
- || state.getBlock() == Blocks.wooden_button || state.getBlock() == Blocks.stone_button
- || state.getBlock() == Blocks.fire || state.getBlock() == Blocks.torch
- || state.getBlock() == Blocks.rail || state.getBlock() == Blocks.golden_rail
- || state.getBlock() == Blocks.activator_rail || state.getBlock() == Blocks.activator_rail
- || state.getBlock() == Blocks.carpet || state.getBlock() == Blocks.redstone_torch
- || (state == Blocks.stone.getStateFromMeta(2));
+ Block b = state.getBlock();
+ return state.equals(preBuilt) || allowed.contains(b);
}
}