Skip to content
This repository has been archived by the owner on Mar 5, 2023. It is now read-only.

Commit

Permalink
Inital commit
Browse files Browse the repository at this point in the history
  • Loading branch information
RappyTV committed Aug 24, 2022
1 parent 6d26588 commit f8494eb
Show file tree
Hide file tree
Showing 15 changed files with 357 additions and 247 deletions.
144 changes: 19 additions & 125 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,129 +1,23 @@
# Created by .ignore support plugin (hsz.mobi)
### Java template

# Log file
*.log

# BlueJ files
*.ctxt

# Mobile Tools for Java (J2ME)
.mtj.tmp/

# Package Files #
*.war
*.nar
*.ear
*.zip
*.tar.gz
*.rar
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
hs_err_pid*

### JetBrains template
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and WebStorm
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839

# User-specific stuff
.idea/**/workspace.xml
.idea/**/tasks.xml
.idea/**/usage.statistics.xml
.idea/**/dictionaries
.idea/**/shelf
.idea/**/misc.xml
.idea/**/discord.xml
.idea/**/encodings.xml
.idea/codeStyles/
.idea/sonarlint/

# Generated files
.idea/**/contentModel.xml
.idea/**/jarRepositories.xml
.idea/**/uiDesigner.xml
.idea/**/inspectionProfiles
.idea/**/.name
.idea/**/vcs.xml
.idea/**/compiler.xml
run/**

# Sensitive or high-churn files
.idea/**/dataSources/
.idea/**/dataSources.ids
.idea/**/dataSources.local.xml
.idea/**/sqlDataSources.xml
.idea/**/dynamic.xml
.idea/**/dbnavigator.xml
.idea/kotlinScripting.xml

# Gradle
.idea/**/gradle.xml
.idea/**/libraries

# Gradle and Maven with auto-import
# When using Gradle or Maven with auto-import, you should exclude module files,
# since they will be recreated, and may cause churn. Uncomment if using
# auto-import.
# .idea/artifacts
# .idea/compiler.xml
.idea/modules.xml
.idea/*.iml
# .idea/modules
# *.iml
# *.ipr

# CMake
cmake-build-*/

# Mongo Explorer plugin
.idea/**/mongoSettings.xml

# File-based project format
# eclipse
bin
*.launch
.settings
.metadata
.classpath
.project

# idea
out
*.ipr
*.iws
*.iml
.idea

# IntelliJ
out/

# mpeltonen/sbt-idea plugin
.idea_modules/

# JIRA plugin
atlassian-ide-plugin.xml

# Cursive Clojure plugin
.idea/replstate.xml

# Crashlytics plugin (for Android Studio and IntelliJ)
com_crashlytics_export_strings.xml
crashlytics.properties
crashlytics-build.properties
fabric.properties

# Editor-based Rest Client
.idea/httpRequests

# Android studio 3.1+ serialized cache file
.idea/caches/build_file_checksums.ser

### Gradle template
# gradle
build
.gradle
/**/build/

# Ignore Gradle GUI config
gradle-app.setting

# Avoid ignoring Gradle wrapper jar file (.jar files are usually ignored)
!gradle-wrapper.jar

# Cache of project
.gradletasknamecache

# # Work around https://youtrack.jetbrains.com/issue/IDEA-116898
# gradle/wrapper/gradle-wrapper.properties

.idea/modules/
src/test/
**/src/main/generated/*

.idea/intellij-javadocs-4.0.1.xml
run/
libs/
# other
eclipse
run
*.bat
38 changes: 38 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# **HeadOwner**
> With this Addon you can add a new modules to your screen which shows the username of the playerhead you're looking at.
### Installation
1. Press `Win` + `R`
2. Paste this into the window that popped up: `%appdata%/.minecraft/LabyMod/addons-1.12` and press enter
3. It should open your Labymod addon directory; Paste the [HeadOwner.jar](https://github.com/RappyLabyAddons/HeadOwner/releases/download/1.0.0/HeadOwner.jar) in there.
4. Launch your Labymod client.

### Config
- "Enabled" - Lets you disable the addon.
- "Block reach distance" - Lets you choose a range of sight the plugin will check for skulls.
- "Copy head data to clipboard" - Lets you choose a key which copys the informations about the skulls you're looking at.
<br>

If you have any problems with the addon/have update ideas, feel free to
- Open an Issue [here](https://github.com/RappyLabyAddons/HeadOwner/issues/new/choose)
or
- Open a ticket on my [Discord Server](https://rappytv.com/server) in [this](https://discord.com/channels/815912035124248587/840285653946204181) channel

> Credits [@TebosBrime](https://github.com/TebosBrime)
---

### Social Networks

[<img align="left" alt="RappyTV | Website" width="22px" src="https://raw.githubusercontent.com/iconic/open-iconic/master/svg/globe.svg" />][website]
[<img align="left" alt="RappyTV | YouTube" width="22px" src="https://cdn.jsdelivr.net/npm/simple-icons@v3/icons/youtube.svg" />][youtube]
[<img align="left" alt="RappyTV | Instagram" width="22px" src="https://cdn.jsdelivr.net/npm/simple-icons@v3/icons/instagram.svg" />][instagram]
[<img align="left" alt="RappyTV | Discord" width="22px" src="https://cdn.jsdelivr.net/npm/simple-icons@v3/icons/discord.svg" />][dcServer]
[<img align="left" alt="RappyTV | TikTok" width="22px" src="https://cdn.jsdelivr.net/npm/simple-icons@v3/icons/tiktok.svg" />][tiktok]

[website]: https://rappytv.com/
[youtube]: https://youtube.com/c/RappyTVTutorials
[instagram]: https://instagram.com/rappyytv
[dcbotplaylist]: https://youtube.com/playlist?list=PL-NddfqjbJVZ2-CGquW0I42J9IGUkXq12
[dcServer]: https://rappytv.com/server
[dcBot]: https://rappytv.com/bot
[tiktok]: https://tiktok.com/@rappytv
6 changes: 3 additions & 3 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ apply plugin: 'eclipse'
apply plugin: 'maven-publish'
apply plugin: 'org.spongepowered.mixin'

version = '1.0.0'
group = 'com.example' // http://maven.apache.org/guides/mini/guide-naming-conventions.html
archivesBaseName = 'Example Addon'
version = '1'
group = 'com.rappytv' // http://maven.apache.org/guides/mini/guide-naming-conventions.html
archivesBaseName = 'headowner'

sourceCompatibility = targetCompatibility = compileJava.sourceCompatibility = compileJava.targetCompatibility = '1.8' // Need this here so eclipse task generates correctly.

Expand Down
Binary file added libs/lm_api_mc1.16.5.jar
Binary file not shown.
25 changes: 0 additions & 25 deletions src/main/java/com/example/addon/ExampleAddon.java

This file was deleted.

12 changes: 0 additions & 12 deletions src/main/java/com/example/addon/ExampleAddonTransformer.java

This file was deleted.

17 changes: 0 additions & 17 deletions src/main/java/com/example/addon/mixin/ExampleMixin.java

This file was deleted.

67 changes: 67 additions & 0 deletions src/main/java/com/rappytv/headowner/HeadOwnerAddon.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
package com.rappytv.headowner;

import com.rappytv.headowner.listeners.MessageSendListener;
import com.rappytv.headowner.modules.HeadModule;
import net.labymod.api.LabyModAddon;
import net.labymod.settings.elements.*;
import net.labymod.utils.Consumer;
import net.labymod.utils.Material;

import java.util.List;

public class HeadOwnerAddon extends LabyModAddon {

public static String prefix = "\u00A7d\u00A7lHeadOwner \u00A78\u00bb \u00A7r";
public static boolean enabled = true;
public static int length = 10;
public static String copyCmd = "copy";

public static HeadOwnerAddon instance;

@Override
public void onEnable() {
instance = this;
getApi().registerModule(new HeadModule());
getApi().getEventService().registerListener(new MessageSendListener());
}

@Override
public void loadConfig() {
enabled = getConfig().has("enabled") ? getConfig().get("enabled").getAsBoolean() : enabled;
length = getConfig().has("length") ? getConfig().get("length").getAsInt() : length;
copyCmd = getConfig().has("copyCmd") ? getConfig().get("copyCmd").getAsString() : copyCmd;
}

@Override
protected void fillSettings(List<SettingsElement> list) {
BooleanElement enabledEl = new BooleanElement("Enabled", new ControlElement.IconData(Material.LEVER), new Consumer<Boolean>() {

@Override
public void accept(Boolean value) {
enabled = value;

getConfig().addProperty("enabled", enabled);
saveConfig();
}
}, enabled);

NumberElement lengthEl = new NumberElement("Block reach distance", new ControlElement.IconData(Material.MAP), length)
.addCallback((integer) -> {
length = integer;

getConfig().addProperty("length", length);
saveConfig();
});

StringElement copyCmdEl = new StringElement("Command to copy head data to clipboard", new ControlElement.IconData(Material.COMMAND), copyCmd, value -> {
copyCmd = value;

getConfig().addProperty("copyCmd", copyCmd);
saveConfig();
});

list.add(enabledEl);
list.add(lengthEl);
list.add(copyCmdEl);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
package com.rappytv.headowner.listeners;

import com.rappytv.headowner.HeadOwnerAddon;
import com.rappytv.headowner.util.Util;
import net.labymod.api.event.Subscribe;
import net.labymod.api.event.events.client.chat.MessageSendEvent;
import net.labymod.main.LabyMod;

import java.awt.*;
import java.awt.datatransfer.Clipboard;
import java.awt.datatransfer.ClipboardOwner;
import java.awt.datatransfer.StringSelection;

public class MessageSendListener {

@Subscribe
public void onMessage(final MessageSendEvent event) {
event.setCancelled(onSend(event.getMessage()));
}

public boolean onSend(String s) {
String[] args = s.split(" ");
if (HeadOwnerAddon.enabled && args[0].equalsIgnoreCase("/" + HeadOwnerAddon.copyCmd)) {
Util.Skull skull = Util.getSkullLooking();
String name = skull.getCopy();
StringSelection stringSelection = new StringSelection(name);

if(skull.getDisplay().equalsIgnoreCase("Skull")) {
LabyMod.getInstance().getLabyModAPI().displayMessageInChat(HeadOwnerAddon.prefix + "\u00A7cNo head found!");
return true;
}

try {
Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard();
clipboard.setContents(stringSelection, (ClipboardOwner) null);
LabyMod.getInstance().getLabyModAPI().displayMessageInChat(HeadOwnerAddon.prefix + "\u00A7eHead Info copied!");
} catch (IllegalStateException e) {
e.printStackTrace();
LabyMod.getInstance().getLabyModAPI().displayMessageInChat(HeadOwnerAddon.prefix + "\u00A7cCan't modify clipboard :/");
}
return true;
}
return false;
}
}
Loading

0 comments on commit f8494eb

Please sign in to comment.