Add isolated chat option.
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
name: MobArena
|
name: MobArena
|
||||||
author: garbagemule
|
author: garbagemule
|
||||||
main: com.garbagemule.MobArena.MobArena
|
main: com.garbagemule.MobArena.MobArena
|
||||||
version: 0.95.5.1
|
version: 0.95.5.3
|
||||||
softdepend: [Spout,Towny,Heroes,MagicSpells,Vault]
|
softdepend: [Spout,Towny,Heroes,MagicSpells,Vault]
|
||||||
commands:
|
commands:
|
||||||
ma:
|
ma:
|
||||||
|
|||||||
@@ -38,4 +38,5 @@ use-class-chests: false
|
|||||||
display-waves-as-level: false
|
display-waves-as-level: false
|
||||||
display-timer-as-level: false
|
display-timer-as-level: false
|
||||||
use-scoreboards: true
|
use-scoreboards: true
|
||||||
|
isolated-chat: false
|
||||||
global-end-announce: false
|
global-end-announce: false
|
||||||
|
|||||||
@@ -94,6 +94,7 @@ public class ArenaImpl implements Arena
|
|||||||
private List<ItemStack> entryFee;
|
private List<ItemStack> entryFee;
|
||||||
private TimeStrategy timeStrategy;
|
private TimeStrategy timeStrategy;
|
||||||
private AutoStartTimer autoStartTimer;
|
private AutoStartTimer autoStartTimer;
|
||||||
|
private boolean isolatedChat;
|
||||||
|
|
||||||
// Scoreboards
|
// Scoreboards
|
||||||
private ScoreboardManager scoreboard;
|
private ScoreboardManager scoreboard;
|
||||||
@@ -158,6 +159,8 @@ public class ArenaImpl implements Arena
|
|||||||
|
|
||||||
int autoStart = settings.getInt("auto-start-timer", 0);
|
int autoStart = settings.getInt("auto-start-timer", 0);
|
||||||
this.autoStartTimer = new AutoStartTimer(this, autoStart);
|
this.autoStartTimer = new AutoStartTimer(this, autoStart);
|
||||||
|
|
||||||
|
this.isolatedChat = settings.getBoolean("isolated-chat", false);
|
||||||
|
|
||||||
String timeString = settings.getString("player-time-in-arena", "world");
|
String timeString = settings.getString("player-time-in-arena", "world");
|
||||||
Time time = Enums.getEnumFromString(Time.class, timeString);
|
Time time = Enums.getEnumFromString(Time.class, timeString);
|
||||||
@@ -1361,6 +1364,11 @@ public class ArenaImpl implements Arena
|
|||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean hasIsolatedChat() {
|
||||||
|
return isolatedChat;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The "perfect equals method" cf. "Object-Oriented Design and Patterns"
|
* The "perfect equals method" cf. "Object-Oriented Design and Patterns"
|
||||||
|
|||||||
@@ -237,4 +237,6 @@ public interface Arena
|
|||||||
public boolean canJoin(Player p);
|
public boolean canJoin(Player p);
|
||||||
|
|
||||||
public boolean canSpec(Player p);
|
public boolean canSpec(Player p);
|
||||||
|
|
||||||
|
public boolean hasIsolatedChat();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -204,6 +204,16 @@ public class MAGlobalListener implements Listener
|
|||||||
arena.getEventListener().onPlayerBucketEmpty(event);
|
arena.getEventListener().onPlayerBucketEmpty(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@EventHandler(priority = EventPriority.LOW, ignoreCancelled = true)
|
||||||
|
public void playerChat(AsyncPlayerChatEvent event) {
|
||||||
|
if (!am.isEnabled()) return;
|
||||||
|
|
||||||
|
Arena arena = am.getArenaWithPlayer(event.getPlayer());
|
||||||
|
if (arena == null || !arena.hasIsolatedChat()) return;
|
||||||
|
|
||||||
|
event.getRecipients().retainAll(arena.getAllPlayers());
|
||||||
|
}
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.LOWEST)
|
@EventHandler(priority = EventPriority.LOWEST)
|
||||||
public void playerCommandPreprocess(PlayerCommandPreprocessEvent event) {
|
public void playerCommandPreprocess(PlayerCommandPreprocessEvent event) {
|
||||||
if (!am.isEnabled()) return;
|
if (!am.isEnabled()) return;
|
||||||
|
|||||||
Reference in New Issue
Block a user