mirror of
https://github.com/garbagemule/MobArena.git
synced 2025-02-17 04:51:28 +01:00
Add isolated chat option.
This commit is contained in:
parent
9230f823fb
commit
ea4031b0ed
@ -1,7 +1,7 @@
|
||||
name: MobArena
|
||||
author: garbagemule
|
||||
main: com.garbagemule.MobArena.MobArena
|
||||
version: 0.95.5.1
|
||||
version: 0.95.5.3
|
||||
softdepend: [Spout,Towny,Heroes,MagicSpells,Vault]
|
||||
commands:
|
||||
ma:
|
||||
|
@ -38,4 +38,5 @@ use-class-chests: false
|
||||
display-waves-as-level: false
|
||||
display-timer-as-level: false
|
||||
use-scoreboards: true
|
||||
isolated-chat: false
|
||||
global-end-announce: false
|
||||
|
@ -94,6 +94,7 @@ public class ArenaImpl implements Arena
|
||||
private List<ItemStack> entryFee;
|
||||
private TimeStrategy timeStrategy;
|
||||
private AutoStartTimer autoStartTimer;
|
||||
private boolean isolatedChat;
|
||||
|
||||
// Scoreboards
|
||||
private ScoreboardManager scoreboard;
|
||||
@ -158,6 +159,8 @@ public class ArenaImpl implements Arena
|
||||
|
||||
int autoStart = settings.getInt("auto-start-timer", 0);
|
||||
this.autoStartTimer = new AutoStartTimer(this, autoStart);
|
||||
|
||||
this.isolatedChat = settings.getBoolean("isolated-chat", false);
|
||||
|
||||
String timeString = settings.getString("player-time-in-arena", "world");
|
||||
Time time = Enums.getEnumFromString(Time.class, timeString);
|
||||
@ -1361,6 +1364,11 @@ public class ArenaImpl implements Arena
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasIsolatedChat() {
|
||||
return isolatedChat;
|
||||
}
|
||||
|
||||
/**
|
||||
* The "perfect equals method" cf. "Object-Oriented Design and Patterns"
|
||||
|
@ -237,4 +237,6 @@ public interface Arena
|
||||
public boolean canJoin(Player p);
|
||||
|
||||
public boolean canSpec(Player p);
|
||||
|
||||
public boolean hasIsolatedChat();
|
||||
}
|
||||
|
@ -204,6 +204,16 @@ public class MAGlobalListener implements Listener
|
||||
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)
|
||||
public void playerCommandPreprocess(PlayerCommandPreprocessEvent event) {
|
||||
if (!am.isEnabled()) return;
|
||||
|
Loading…
Reference in New Issue
Block a user