Skip to content

Commit 488a1ee

Browse files
committed
[Update] Update to latest Bukkit RB./Remove all references to no longer used mChatSuite and SpoutPlugin.
1 parent da02063 commit 488a1ee

11 files changed

Lines changed: 7 additions & 164 deletions

File tree

src/main/java/ca/q0r/madvanced/MAdvanced.java

Lines changed: 4 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,25 @@
11
package ca.q0r.madvanced;
22

33
import ca.q0r.madvanced.commands.*;
4-
import ca.q0r.madvanced.events.*;
4+
import ca.q0r.madvanced.events.ChatListener;
5+
import ca.q0r.madvanced.events.CommandListener;
6+
import ca.q0r.madvanced.events.EntityListener;
7+
import ca.q0r.madvanced.events.PlayerListener;
58
import ca.q0r.madvanced.yml.YmlManager;
69
import ca.q0r.madvanced.yml.config.ConfigType;
710
import ca.q0r.madvanced.yml.locale.LocaleType;
811
import ca.q0r.mchat.api.API;
9-
import ca.q0r.mchat.api.Parser;
1012
import ca.q0r.mchat.metrics.Metrics;
1113
import ca.q0r.mchat.util.MessageUtil;
1214
import ca.q0r.mchat.util.Timer;
1315
import org.bukkit.Bukkit;
1416
import org.bukkit.Location;
1517
import org.bukkit.command.CommandExecutor;
1618
import org.bukkit.entity.Player;
17-
import org.bukkit.plugin.Plugin;
1819
import org.bukkit.plugin.PluginDescriptionFile;
1920
import org.bukkit.plugin.PluginManager;
2021
import org.bukkit.plugin.java.JavaPlugin;
2122
import org.bukkit.scheduler.BukkitRunnable;
22-
import org.getspout.spoutapi.player.SpoutPlayer;
2323

2424
import java.util.Date;
2525
import java.util.HashMap;
@@ -29,9 +29,6 @@ public class MAdvanced extends JavaPlugin {
2929
private PluginManager pm;
3030
private PluginDescriptionFile pdfFile;
3131

32-
// Spout
33-
public Boolean spoutB = false;
34-
3532
// Maps
3633
public HashMap<String, Boolean> isChatting = new HashMap<String, Boolean>();
3734
public HashMap<String, Boolean> isAFK = new HashMap<String, Boolean>();
@@ -64,9 +61,6 @@ public void run() {
6461
// Load Yml
6562
YmlManager.initialize();
6663

67-
// Setup Plugins
68-
setupPlugins();
69-
7064
// Register Events
7165
registerEvents();
7266

@@ -80,11 +74,6 @@ public void run() {
8074
isChatting.put(players.getName(), false);
8175
isAFK.put(players.getName(), false);
8276
lastMove.put(players.getName(), new Date().getTime());
83-
84-
if (spoutB) {
85-
SpoutPlayer sPlayers = (SpoutPlayer) players;
86-
sPlayers.setTitle(Parser.parsePlayerName(players.getName(), players.getWorld().getName()));
87-
}
8877
}
8978

9079
// Stop the Timer
@@ -122,30 +111,7 @@ public void onDisable() {
122111
}
123112
}
124113

125-
Boolean setupPlugin(String pluginName) {
126-
Plugin plugin = pm.getPlugin(pluginName);
127-
128-
if (plugin != null) {
129-
MessageUtil.log("[" + pdfFile.getName() + "] <Plugin> " + plugin.getDescription().getName() + " v" + plugin.getDescription().getVersion() + " hooked!.");
130-
return true;
131-
}
132-
133-
return false;
134-
}
135-
136-
void setupPlugins() {
137-
spoutB = setupPlugin("Spout");
138-
139-
if (!ConfigType.MCHAT_SPOUT.getBoolean()) {
140-
spoutB = false;
141-
}
142-
}
143-
144114
void registerEvents() {
145-
if (spoutB) {
146-
pm.registerEvents(new CustomListener(this), this);
147-
}
148-
149115
pm.registerEvents(new ChatListener(this), this);
150116
pm.registerEvents(new CommandListener(), this);
151117
pm.registerEvents(new EntityListener(this), this);

src/main/java/ca/q0r/madvanced/commands/AFKOtherCommand.java

Lines changed: 1 addition & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,10 @@
99
import ca.q0r.mchat.util.CommandUtil;
1010
import ca.q0r.mchat.util.MessageUtil;
1111
import org.bukkit.ChatColor;
12-
import org.bukkit.Material;
1312
import org.bukkit.command.Command;
1413
import org.bukkit.command.CommandExecutor;
1514
import org.bukkit.command.CommandSender;
1615
import org.bukkit.entity.Player;
17-
import org.getspout.spoutapi.player.SpoutPlayer;
1816

1917
import java.util.TreeMap;
2018

@@ -59,8 +57,6 @@ public boolean onCommand(CommandSender sender, Command command, String label, St
5957
}
6058

6159
notification = LocaleType.MESSAGE_PLAYER_AFK.getVal();
62-
63-
title = ChatColor.valueOf(LocaleType.MESSAGE_SPOUT_COLOUR.getRaw().toUpperCase()) + "- AFK -" + '\n' + title;
6460
}
6561

6662
TreeMap<String, String> rMap = new TreeMap<String, String>();
@@ -69,23 +65,7 @@ public boolean onCommand(CommandSender sender, Command command, String label, St
6965
rMap.put("reason", message);
7066
rMap.put("r", message);
7167

72-
if (plugin.spoutB) {
73-
for (Player players : plugin.getServer().getOnlinePlayers()) {
74-
SpoutPlayer sPlayers = (SpoutPlayer) players;
75-
76-
if (sPlayers.isSpoutCraftEnabled()) {
77-
sPlayers.sendNotification(afkTarget.getName(), API.replace(notification, "player", "", IndicatorType.LOCALE_VAR), Material.PAPER);
78-
} else {
79-
players.sendMessage(API.replace(notification, rMap, IndicatorType.LOCALE_VAR));
80-
}
81-
}
82-
83-
SpoutPlayer sPlayer = (SpoutPlayer) afkTarget;
84-
85-
sPlayer.setTitle(title);
86-
} else {
87-
plugin.getServer().broadcastMessage(API.replace(notification, rMap, IndicatorType.LOCALE_VAR));
88-
}
68+
plugin.getServer().broadcastMessage(API.replace(notification, rMap, IndicatorType.LOCALE_VAR));
8969

9070
afkTarget.setSleepingIgnored(!isAfk);
9171
plugin.isAFK.put(afkTarget.getName(), !isAfk);

src/main/java/ca/q0r/madvanced/commands/AdvancedCommand.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22

33
import ca.q0r.madvanced.yml.YmlManager;
44
import ca.q0r.madvanced.yml.YmlType;
5-
import ca.q0r.madvanced.yml.config.ConfigYml;
6-
import ca.q0r.madvanced.yml.locale.LocaleYml;
75
import ca.q0r.mchat.util.CommandUtil;
86
import ca.q0r.mchat.util.MessageUtil;
97
import org.bukkit.command.Command;
Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,11 @@
11
package ca.q0r.madvanced.events;
22

33
import ca.q0r.madvanced.MAdvanced;
4-
import ca.q0r.madvanced.yml.locale.LocaleType;
5-
import ca.q0r.mchat.api.Parser;
6-
import ca.q0r.mchat.util.MessageUtil;
7-
import org.bukkit.ChatColor;
84
import org.bukkit.entity.Player;
95
import org.bukkit.event.EventHandler;
106
import org.bukkit.event.EventPriority;
117
import org.bukkit.event.Listener;
128
import org.bukkit.event.player.AsyncPlayerChatEvent;
13-
import org.getspout.spoutapi.player.SpoutPlayer;
149

1510
import java.util.Date;
1611

@@ -30,7 +25,6 @@ public void onPlayerChat(AsyncPlayerChatEvent event) {
3025
Player player = event.getPlayer();
3126
String pName = player.getName();
3227

33-
String world = player.getWorld().getName();
3428
String msg = event.getMessage();
3529

3630
if (msg == null) {
@@ -44,27 +38,5 @@ public void onPlayerChat(AsyncPlayerChatEvent event) {
4438
}
4539

4640
plugin.lastMove.put(pName, new Date().getTime());
47-
48-
if (plugin.spoutB) {
49-
SpoutPlayer sPlayer = (SpoutPlayer) player;
50-
final String sPName = pName;
51-
52-
sPlayer.setTitle(ChatColor.valueOf(LocaleType.MESSAGE_SPOUT_COLOUR.getRaw().toUpperCase())
53-
+ "- " + MessageUtil.addColour(msg) + ChatColor.valueOf(LocaleType.MESSAGE_SPOUT_COLOUR.getRaw().toUpperCase())
54-
+ " -" + '\n' + Parser.parsePlayerName(pName, world));
55-
56-
plugin.isChatting.put(pName, false);
57-
58-
plugin.getServer().getScheduler().scheduleSyncDelayedTask(plugin, new Runnable() {
59-
public void run() {
60-
SpoutPlayer sPlayer = (SpoutPlayer) plugin.getServer().getPlayer(sPName);
61-
62-
if (sPlayer != null) {
63-
sPlayer.setTitle(Parser.parsePlayerName(sPName, sPlayer.getWorld().getName()));
64-
}
65-
}
66-
}, 7 * 20);
67-
}
68-
6941
}
7042
}

src/main/java/ca/q0r/madvanced/events/CustomListener.java

Lines changed: 0 additions & 55 deletions
This file was deleted.

src/main/java/ca/q0r/madvanced/events/PlayerListener.java

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
import ca.q0r.madvanced.MAdvanced;
44
import ca.q0r.madvanced.yml.config.ConfigType;
55
import ca.q0r.madvanced.yml.locale.LocaleType;
6-
import ca.q0r.mchat.api.Parser;
76
import ca.q0r.mchat.util.MessageUtil;
87
import org.bukkit.Location;
98
import org.bukkit.entity.Player;
@@ -13,7 +12,6 @@
1312
import org.bukkit.event.player.PlayerCommandPreprocessEvent;
1413
import org.bukkit.event.player.PlayerJoinEvent;
1514
import org.bukkit.event.player.PlayerMoveEvent;
16-
import org.getspout.spoutapi.player.SpoutPlayer;
1715

1816
import java.util.Date;
1917

@@ -50,17 +48,10 @@ public void onPlayerCommandPreprocess(PlayerCommandPreprocessEvent event) {
5048
@EventHandler(priority = EventPriority.LOWEST)
5149
public void onPlayerJoin(PlayerJoinEvent event) {
5250
Player player = event.getPlayer();
53-
String world = player.getWorld().getName();
54-
String pName = player.getName();
5551

5652
plugin.isChatting.put(player.getName(), false);
5753
plugin.isAFK.put(player.getName(), false);
5854
plugin.lastMove.put(player.getName(), new Date().getTime());
59-
60-
if (plugin.spoutB) {
61-
SpoutPlayer sPlayer = (SpoutPlayer) player;
62-
sPlayer.setTitle(Parser.parsePlayerName(pName, world));
63-
}
6455
}
6556

6657
@EventHandler

src/main/java/ca/q0r/madvanced/yml/config/ConfigType.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@
88
import java.util.List;
99

1010
public enum ConfigType {
11-
MCHAT_SPOUT("plugin.spout"),
12-
1311
OPTION_HC_AFK("option.eHQAFK"),
1412
OPTION_USE_GROUPED_LIST("option.useGroupedList"),
1513
OPTION_LIST_VAR("option.listVar"),

src/main/java/ca/q0r/madvanced/yml/config/ConfigYml.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,6 @@ public ConfigYml() {
3030
}
3131

3232
public void loadDefaults() {
33-
checkOption("plugin.spout", true);
34-
3533
checkOption("option.eHQAFK", true);
3634
checkOption("option.useGroupedList", true);
3735
checkOption("option.listVar", "group");

src/main/java/ca/q0r/madvanced/yml/locale/LocaleType.java

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,7 @@ public enum LocaleType {
1010
MESSAGE_LIST_HEADER("message.list.header"),
1111
MESSAGE_PLAYER_AFK("message.player.afk"),
1212
MESSAGE_PLAYER_NOT_AFK("message.player.notAfk"),
13-
MESSAGE_PLAYER_STILL_AFK("message.player.stillAfk"),
14-
MESSAGE_SPOUT_COLOUR("message.spout.colour"),
15-
MESSAGE_SPOUT_TYPING("message.spout.typing");
16-
13+
MESSAGE_PLAYER_STILL_AFK("message.player.stillAfk");
1714
private final String option;
1815

1916
LocaleType(String option) {

src/main/java/ca/q0r/madvanced/yml/locale/LocaleYml.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,6 @@ public void loadDefaults() {
1818
checkOption("message.player.afk", "%player is now AFK. [ %reason ]");
1919
checkOption("message.player.notAfk", "%player is no longer AFK.");
2020
checkOption("message.player.stillAfk", "You are still AFK.");
21-
checkOption("message.spout.colour", "dark_red");
22-
checkOption("message.spout.typing", "*Typing*");
2321

2422
save();
2523
}

0 commit comments

Comments
 (0)