Skip to content

Commit

Permalink
2.0.6 & 2.0.7
Browse files Browse the repository at this point in the history
  • Loading branch information
d0by1 committed Feb 19, 2022
1 parent db075c0 commit dcbefa6
Show file tree
Hide file tree
Showing 12 changed files with 37 additions and 25 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 {
defaultTasks 'build'

group 'eu.decentsoftware.holograms'
version '2.2.6'
version '2.2.7'
description 'Lightweight yet very powerful hologram plugin with many features and configuration options.'

repositories {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,6 @@ public static boolean isRunning() {

/**
* Get the instance of running DecentHolograms.
* <p>
* If you use shaded version of the API, you must enable
* it first using {@link DecentHologramsAPI#onEnable()} class.
* Also, don't forget to disable the API in you onDisable method
* when you are done using it. {@link DecentHologramsAPI#onDisable()}
* </p>
*
* @return the instance of running DecentHolograms.
*/
Expand Down
3 changes: 2 additions & 1 deletion src/main/java/eu/decentsoftware/holograms/api/Settings.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,11 @@ public class Settings {
public static final Configuration CONFIG = new Configuration(DECENT_HOLOGRAMS.getPlugin(), DECENT_HOLOGRAMS.getDataFolder(), "config.yml");

public static final ConfigValue<Boolean> CHECK_UPDATES = new ConfigValue<>(CONFIG, false, "update-checker", true);
public static final IntegerConfigValue CLICK_COOLDOWN = new IntegerConfigValue(CONFIG, false, "click-cooldown", 20, 10, 300);

public static final ConfigValue<String> DEFAULT_TEXT = new ConfigValue<>(CONFIG, false, "defaults.text", "Blank Line");
public static final ConfigValue<Boolean> DEFAULT_DOWN_ORIGIN = new ConfigValue<>(CONFIG, false, "defaults.down-origin", false);
public static final ConfigValue<Boolean> DEFAULT_ALWAYS_FACE_PLAYER = new ConfigValue<>(CONFIG, false, "defaults.always-face-player", true);
// public static final ConfigValue<Boolean> DEFAULT_ALWAYS_FACE_PLAYER = new ConfigValue<>(CONFIG, false, "defaults.always-face-player", true);

public static final DoubleConfigValue DEFAULT_HEIGHT_TEXT = new DoubleConfigValue(CONFIG, false, "defaults.height.text", 0.3D, 0.0D, 2.5D);
public static final DoubleConfigValue DEFAULT_HEIGHT_ICON = new DoubleConfigValue(CONFIG, false, "defaults.height.icon", 0.6D, 0.0D, 2.5D);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,8 @@ public boolean execute(Player player, String... args) {
Validate.notNull(player);

String string = String.join(":", args);
if (string.split(":").length != 4) {
String[] spl = string.split(":");
if (spl.length == 3 || spl.length == 5) {
string = player.getLocation().getWorld().getName() + ":" + string;
}
Location location = LocationUtils.asLocation(string);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,9 +87,9 @@ public static Collection<Hologram> getCachedHolograms() {
if (config.isBoolean("down-origin")) {
hologram.setDownOrigin(config.getBoolean("down-origin", Settings.DEFAULT_DOWN_ORIGIN.getValue()));
}
if (config.isBoolean("always-face-player")) {
hologram.setAlwaysFacePlayer(config.getBoolean("always-face-player", Settings.DEFAULT_ALWAYS_FACE_PLAYER.getValue()));
}
// if (config.isBoolean("always-face-player")) {
// hologram.setAlwaysFacePlayer(config.getBoolean("always-face-player", Settings.DEFAULT_ALWAYS_FACE_PLAYER.getValue()));
// }

if (!config.contains("pages") && config.contains("lines")) {
// Old Config
Expand Down Expand Up @@ -160,7 +160,7 @@ public static Collection<Hologram> getCachedHolograms() {
protected final Map<UUID, Integer> viewerPages = new ConcurrentHashMap<>();
protected final DList<HologramPage> pages = new DList<>();
protected boolean downOrigin = Settings.DEFAULT_DOWN_ORIGIN.getValue();
protected boolean alwaysFacePlayer = Settings.DEFAULT_ALWAYS_FACE_PLAYER.getValue();
protected boolean alwaysFacePlayer = false; //Settings.DEFAULT_ALWAYS_FACE_PLAYER.getValue();
private final AtomicInteger tickCounter;

/*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -401,7 +401,7 @@ public void updateAnimations(Player... players) {
if (HologramLineType.TEXT.equals(type)) {
UUID uuid = player.getUniqueId();
String lastText = lastTextMap.get(uuid);
String text = getText(player, false);
String text = getText(player, true);
if (!text.equals(lastText)) {
lastTextMap.put(uuid, text);
nms.updateFakeEntityCustomName(player, text, entityIds[0]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import com.google.common.cache.CacheBuilder;
import eu.decentsoftware.holograms.api.DecentHolograms;
import eu.decentsoftware.holograms.api.DecentHologramsAPI;
import eu.decentsoftware.holograms.api.Settings;
import eu.decentsoftware.holograms.api.actions.ClickType;
import eu.decentsoftware.holograms.api.holograms.offset.OffsetListener;
import eu.decentsoftware.holograms.api.utils.Common;
Expand Down Expand Up @@ -33,7 +34,7 @@ public class HologramManager extends Ticked {
public HologramManager() {
super(20L);
this.clickCooldowns = CacheBuilder.newBuilder()
.expireAfterWrite(250, TimeUnit.MILLISECONDS) // Expire after five ticks
.expireAfterWrite(Settings.CLICK_COOLDOWN.getValue() * 50L, TimeUnit.MILLISECONDS)
.build();
this.offsetListener = null;
this.register();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@

@CommandInfo(
aliases = {"holograms", "hologram", "dh", "holo"},
permission = "",
permission = "dh.default",
usage = "/dh <args>",
description = "The main DecentHolograms Command."
)
Expand Down Expand Up @@ -62,16 +62,16 @@ public HologramsCommand() {
@Override
public CommandHandler getCommandHandler() {
return (sender, args) -> {
if (sender.hasPermission("dh.help")) {
if (sender.hasPermission("dh.admin")) {
if (args.length == 0) {
Lang.USE_HELP.send(sender);
return true;
}
Lang.UNKNOWN_SUB_COMMAND.send(sender);
Lang.USE_HELP.send(sender);
} else {
Lang.sendVersionMessage(sender);
}
Lang.sendVersionMessage(sender);
}
return true;
};
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,11 @@ public void onDamage(EntityDamageEvent e) {
Entity entity = e.getEntity();
double damage = e.getFinalDamage();

Location location = LocationUtils.randomizeLocation(entity.getLocation().clone().add(0, 1, 0));
String text = String.format(appearance.replace("{damage}", "%.1f"), damage);
PLUGIN.getHologramManager().spawnTemporaryHologramLine(location, text, duration);
if (damage > 0d) {
Location location = LocationUtils.randomizeLocation(entity.getLocation().clone().add(0, 1, 0));
String text = String.format(appearance.replace("{damage}", "%.1f"), damage);
PLUGIN.getHologramManager().spawnTemporaryHologramLine(location, text, duration);
}
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,11 @@ public void onDamage(EntityRegainHealthEvent e) {
Entity entity = e.getEntity();
double heal = e.getAmount();

Location location = LocationUtils.randomizeLocation(entity.getLocation().clone().add(0, 1, 0));
String text = String.format(appearance.replace("{heal}", "%.1f"), heal);
PLUGIN.getHologramManager().spawnTemporaryHologramLine(location, text, duration);
if (heal > 0d) {
Location location = LocationUtils.randomizeLocation(entity.getLocation().clone().add(0, 1, 0));
String text = String.format(appearance.replace("{heal}", "%.1f"), heal);
PLUGIN.getHologramManager().spawnTemporaryHologramLine(location, text, duration);
}
}

}
3 changes: 3 additions & 0 deletions src/main/resources/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ defaults:
# Check for updates on plugin startup? [true/false]
update-checker: true

# Click cooldown in ticks
click-cooldown: 20



# # # # # # # # # # # # # # # # #
Expand Down
8 changes: 8 additions & 0 deletions src/main/resources/plugin.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,11 @@ commands:
aliases: [dh, holograms, hologram, holo]
usage: /decentholograms <args>
description: The main command of DecentHolograms plugin.

permissions:
dh.admin:
dh.default: true
description: Allows player to use DecentHolograms.
dh.default:
default: true
description: Allows player to see the version after using '/decentholograms'.

1 comment on commit dcbefa6

@d0by1
Copy link
Member Author

@d0by1 d0by1 commented on dcbefa6 Feb 19, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2.2.6 & 2.2.7

Please sign in to comment.