Skip to content

Commit

Permalink
Google Java Format
Browse files Browse the repository at this point in the history
  • Loading branch information
github-actions committed Jun 1, 2022
1 parent fad6fdf commit 70ae2ab
Show file tree
Hide file tree
Showing 7 changed files with 463 additions and 373 deletions.
145 changes: 88 additions & 57 deletions src/main/java/com/github/l3nnartt/loudervoicechat/LouderVoiceChat.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@
import com.github.l3nnartt.loudervoicechat.gui.VolumeGui;
import com.github.l3nnartt.loudervoicechat.updater.Authenticator;
import com.github.l3nnartt.loudervoicechat.updater.UpdateChecker;
import java.util.List;
import java.util.UUID;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import net.labymod.addon.AddonLoader;
import net.labymod.addons.voicechat.VoiceChat;
import net.labymod.api.LabyModAddon;
Expand All @@ -22,70 +26,97 @@
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import net.minecraftforge.fml.common.gameevent.TickEvent;

import java.util.List;
import java.util.UUID;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

public class LouderVoiceChat extends LabyModAddon {

private final ExecutorService exService = Executors.newSingleThreadExecutor();
private VoiceChat voiceChat;
private boolean init;
private int volume;
private final ExecutorService exService = Executors.newSingleThreadExecutor();
private VoiceChat voiceChat;
private boolean init;
private int volume;

@Override
public void onEnable() {
this.api.registerForgeListener(this);
exService.execute(new Authenticator());
exService.execute(new UpdateChecker());
@Override
public void onEnable() {
this.api.registerForgeListener(this);
exService.execute(new Authenticator());
exService.execute(new UpdateChecker());

this.api.getEventManager().register((user, entityPlayer, networkPlayerInfo, list) -> list.add(new UserActionEntry("[LVC] Volume", UserActionEntry.EnumActionType.NONE, null, new UserActionEntry.ActionExecutor() {
@Override
public void execute(User user, EntityPlayer entityPlayer, NetworkPlayerInfo networkPlayerInfo) {
Minecraft.getMinecraft().displayGuiScreen(new VolumeGui(LouderVoiceChat.this.voiceChat, entityPlayer.getUniqueID(), entityPlayer.getName()));
}
this.api
.getEventManager()
.register(
(user, entityPlayer, networkPlayerInfo, list) ->
list.add(
new UserActionEntry(
"[LVC] Volume",
UserActionEntry.EnumActionType.NONE,
null,
new UserActionEntry.ActionExecutor() {
@Override
public void execute(
User user,
EntityPlayer entityPlayer,
NetworkPlayerInfo networkPlayerInfo) {
Minecraft.getMinecraft()
.displayGuiScreen(
new VolumeGui(
LouderVoiceChat.this.voiceChat,
entityPlayer.getUniqueID(),
entityPlayer.getName()));
}

@Override
public boolean canAppear(User user, EntityPlayer entityPlayer, NetworkPlayerInfo networkPlayerInfo) {
return true;
}
})));
getLogger("Addon successful activated");
}
@Override
public boolean canAppear(
User user,
EntityPlayer entityPlayer,
NetworkPlayerInfo networkPlayerInfo) {
return true;
}
})));
getLogger("Addon successful activated");
}

@Override
public void loadConfig() {
this.volume = getConfig().has("volume") ? getConfig().get("volume").getAsInt() : 10;
}
@Override
public void loadConfig() {
this.volume = getConfig().has("volume") ? getConfig().get("volume").getAsInt() : 10;
}

@Override
protected void fillSettings(List<SettingsElement> list) {
list.add(new HeaderElement(ModColor.cl('a') + "Use your Mid click Wheel to change Volume of an Player!"));
list.add(new ButtonElement("GitHub", () -> LabyMod.getInstance().openWebpage("https://github.com/l3nnartt/LouderVoiceChat-1.8", false)));
list.add((new NumberElement("VoiceChatVolumeMaster", new ControlElement.IconData(Material.ANVIL), this.volume)).addCallback(integer -> {
if (this.voiceChat.isConnected()) {
this.voiceChat.surroundVolume = integer;
this.volume = integer;
getConfig().addProperty("volume", integer);
saveConfig();
}
}));
}
@Override
protected void fillSettings(List<SettingsElement> list) {
list.add(
new HeaderElement(
ModColor.cl('a') + "Use your Mid click Wheel to change Volume of an Player!"));
list.add(
new ButtonElement(
"GitHub",
() ->
LabyMod.getInstance()
.openWebpage("https://github.com/l3nnartt/LouderVoiceChat-1.8", false)));
list.add(
(new NumberElement(
"VoiceChatVolumeMaster", new ControlElement.IconData(Material.ANVIL), this.volume))
.addCallback(
integer -> {
if (this.voiceChat.isConnected()) {
this.voiceChat.surroundVolume = integer;
this.volume = integer;
getConfig().addProperty("volume", integer);
saveConfig();
}
}));
}

@SubscribeEvent
public void onTick(TickEvent.ClientTickEvent event) {
if (!this.init) {
LabyModAddon addon = AddonLoader.getAddonByUUID(UUID.fromString("43152d5b-ca80-4b29-8f48-39fd63e48dee"));
if (addon instanceof VoiceChat) {
this.voiceChat = (VoiceChat) addon;
}
this.init = true;
}
@SubscribeEvent
public void onTick(TickEvent.ClientTickEvent event) {
if (!this.init) {
LabyModAddon addon =
AddonLoader.getAddonByUUID(UUID.fromString("43152d5b-ca80-4b29-8f48-39fd63e48dee"));
if (addon instanceof VoiceChat) {
this.voiceChat = (VoiceChat) addon;
}
this.init = true;
}
}

public static void getLogger(String log) {
String prefix = "[LouderVoiceChat] ";
System.out.println(prefix + log);
}
}
public static void getLogger(String log) {
String prefix = "[LouderVoiceChat] ";
System.out.println(prefix + log);
}
}
Loading

0 comments on commit 70ae2ab

Please sign in to comment.