Skip to content

Commit

Permalink
1.3 update
Browse files Browse the repository at this point in the history
  • Loading branch information
BuildTools committed Mar 24, 2020
1 parent 9443d3a commit 767fc14
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 4 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ plugins {
}

group 'codedcosmos'
version '1.2'
version '1.3'
mainClassName = 'codedcosmos.enderbot.core.EnderBot'

sourceCompatibility = 1.8
Expand Down
2 changes: 1 addition & 1 deletion res/plugin.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: EnderBot
version: 1.2
version: 1.3
author: codedcosmos
main: codedcosmos.enderbot.plugin.MinecraftPlugin
api-version: 1.15
Expand Down
2 changes: 1 addition & 1 deletion src/codedcosmos/enderbot/core/EnderBot.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

public class EnderBot {

private static final String VERSION = "1.2";
private static final String VERSION = "1.3";
private static boolean runningInSpigot = false;

public static void load(boolean runningInSpigot) {
Expand Down
2 changes: 1 addition & 1 deletion src/codedcosmos/enderbot/discord/CachedTextChannel.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public CachedTextChannel(String name, Guild guild) {

public void sendMessage(String message) {
if (!isValid) return;
TextChannelHandler.sendThenWait(channel, message);
TextChannelHandler.send(channel, message);
}

public boolean matches(TextChannel channel) {
Expand Down
17 changes: 17 additions & 0 deletions src/codedcosmos/enderbot/plugin/MinecraftChatListener.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,12 @@
import codedcosmos.enderbot.discord.Guilds;
import codedcosmos.enderbot.utils.Console;
import codedcosmos.enderbot.utils.Log;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.entity.PlayerDeathEvent;
import org.bukkit.event.player.AsyncPlayerChatEvent;
import org.bukkit.event.player.PlayerAdvancementDoneEvent;
import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.event.player.PlayerQuitEvent;

Expand All @@ -45,6 +48,20 @@ public void onPlayerQuit(PlayerQuitEvent event) {
}
}

@EventHandler
public void onPlayerAdvancementDone(PlayerAdvancementDoneEvent event) {
for (GuildContext context : Guilds.getContexts()) {
context.getInGameChannel().sendMessage("`"+format(event.getPlayer().getDisplayName()) + " has made the advancement ["+ event.getAdvancement().getKey().getKey() + "]`");
}
}

@EventHandler
public void onPlayerDeath(PlayerDeathEvent event) {
for (GuildContext context : Guilds.getContexts()) {
context.getInGameChannel().sendMessage("`"+event.getDeathMessage()+"`");
}
}

public String format(String username) {
String text = "";
boolean skipNext = false;
Expand Down

0 comments on commit 767fc14

Please sign in to comment.