Skip to content

Commit

Permalink
Merge pull request #284 from FeyXieXzf/master
Browse files Browse the repository at this point in the history
Remove Timings
  • Loading branch information
CJCrafter committed Apr 5, 2023
2 parents c3b5aed + 43eabff commit d9cd48c
Show file tree
Hide file tree
Showing 9 changed files with 7 additions and 45 deletions.
6 changes: 1 addition & 5 deletions BuildWeaponMechanics/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -79,10 +79,6 @@ tasks.named<ShadowJar>("shadowJar") {
include(dependency("me.cjcrafter:mechanicsautodownload"))
}

relocate("co.aikar.timings.lib", "me.deecaad.weaponmechanics.lib.timings") {
include(dependency("co.aikar:minecraft-timings"))
}

relocate("org.bstats", "me.deecaad.weaponmechanics.lib.bstats") {
include(dependency("org.bstats:"))
}
Expand Down Expand Up @@ -123,4 +119,4 @@ publishing {
}
}
}
}
}
1 change: 0 additions & 1 deletion WeaponMechanics/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ repositories {
dependencies {
api("org.spigotmc:spigot-api:1.19.3-R0.1-SNAPSHOT")
implementation(project(":MechanicsCore"))
implementation("co.aikar:minecraft-timings:1.0.4")
implementation("org.bstats:bstats-bukkit:3.0.0")
implementation("me.cjcrafter:mechanicsautodownload:1.3.1")

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
package me.deecaad.weaponmechanics;

import co.aikar.timings.lib.MCTiming;
import co.aikar.timings.lib.TimingManager;
import com.comphenix.protocol.ProtocolLibrary;
import com.comphenix.protocol.ProtocolManager;
import me.cjcrafter.auto.AutoMechanicsDownload;
Expand Down Expand Up @@ -92,7 +90,6 @@ public class WeaponMechanics {
UpdateChecker updateChecker;
ProjectilesRunnable projectilesRunnable;
ProtocolManager protocolManager;
TimingManager timingManager;
Metrics metrics;
Database database;

Expand Down Expand Up @@ -159,7 +156,6 @@ public void onEnable() {

plugin = this;
entityWrappers = new HashMap<>();
timingManager = TimingManager.of(getPlugin());

writeFiles();
registerPacketListeners();
Expand Down Expand Up @@ -761,15 +757,11 @@ public static WeaponHandler getWeaponHandler() {
return plugin.weaponHandler;
}

public static MCTiming timing(String name) {
return plugin.timingManager.of(name);
}

/**
* @return the database instance if enabled
*/
@Nullable
public static Database getDatabase() {
return plugin.database;
}
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package me.deecaad.weaponmechanics.weapon.melee;

import co.aikar.timings.lib.MCTiming;
import me.deecaad.core.compatibility.CompatibilityAPI;
import me.deecaad.core.compatibility.HitBox;
import me.deecaad.core.utils.ray.RayTraceResult;
Expand Down Expand Up @@ -78,9 +77,7 @@ public boolean tryUse(EntityWrapper entityWrapper, String weaponTitle, ItemStack
if (weaponTitle == null) return false;
}

MCTiming meleeHandlerTiming = WeaponMechanics.timing("Melee Handler").startTiming();
boolean result = meleeWithoutTimings(entityWrapper, weaponTitle, weaponStack, slot, triggerType, dualWield, knownVictim);
meleeHandlerTiming.stopTiming();

return result;
}
Expand Down Expand Up @@ -213,4 +210,4 @@ public void validate(Configuration configuration, SerializeData data) throws Ser
configuration.set(data.key + ".Melee_Miss.Melee_Miss_Delay", meleeMissDelay * 50);
}
}
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package me.deecaad.weaponmechanics.weapon.projectile;

import co.aikar.timings.lib.MCTiming;
import me.deecaad.core.utils.LogLevel;
import me.deecaad.weaponmechanics.WeaponMechanics;
import org.bukkit.Bukkit;
Expand Down Expand Up @@ -141,9 +140,6 @@ public void run() {

Iterator<AProjectile> projectilesIterator = projectiles.iterator();

// Start timings for general projectile ticking.
MCTiming projectilesRunnableTiming = WeaponMechanics.timing("Projectiles Runnable").startTiming();

while (projectilesIterator.hasNext()) {
AProjectile projectile = projectilesIterator.next();
try {
Expand All @@ -161,8 +157,5 @@ public void run() {
debug.log(LogLevel.WARN, "Removed Projectile: " + projectile, e);
}
}

// End timings for projectile ticking
projectilesRunnableTiming.stopTiming();
}
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package me.deecaad.weaponmechanics.weapon.reload;

import co.aikar.timings.lib.MCTiming;
import me.deecaad.core.file.*;
import me.deecaad.core.mechanics.CastData;
import me.deecaad.core.mechanics.Mechanics;
Expand Down Expand Up @@ -85,9 +84,7 @@ public boolean startReloadWithoutTrigger(EntityWrapper entityWrapper, String wea
// This method is called from many places in reload handler and shoot handler as well
// so that's why even startReloadWithoutTriggerAndWithoutTiming() is a separated method

MCTiming reloadHandlerTiming = WeaponMechanics.timing("Reload Handler").startTiming();
boolean result = startReloadWithoutTriggerAndWithoutTiming(entityWrapper, weaponTitle, weaponStack, slot, dualWield, isReloadLoop);
reloadHandlerTiming.stopTiming();

return result;
}
Expand Down Expand Up @@ -589,4 +586,4 @@ public void validate(Configuration configuration, SerializeData data) throws Ser
configuration.set(data.key + ".Shoot_Delay_After_Reload", shootDelayAfterReload * 50);
}
}
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package me.deecaad.weaponmechanics.weapon.scope;

import co.aikar.timings.lib.MCTiming;
import me.deecaad.core.file.*;
import me.deecaad.core.mechanics.CastData;
import me.deecaad.core.mechanics.Mechanics;
Expand Down Expand Up @@ -143,9 +142,7 @@ public boolean tryUse(EntityWrapper entityWrapper, String weaponTitle, ItemStack
* @return true if successfully zoomed in or stacked
*/
private boolean zoomIn(ItemStack weaponStack, String weaponTitle, EntityWrapper entityWrapper, ZoomData zoomData, EquipmentSlot slot) {
MCTiming scopeHandlerTiming = WeaponMechanics.timing("Scope Handler").startTiming();
boolean result = zoomInWithoutTiming(weaponStack, weaponTitle, entityWrapper, zoomData, slot);
scopeHandlerTiming.stopTiming();

return result;
}
Expand Down Expand Up @@ -222,9 +219,7 @@ private boolean zoomInWithoutTiming(ItemStack weaponStack, String weaponTitle, E
* @return true if successfully zoomed out
*/
private boolean zoomOut(ItemStack weaponStack, String weaponTitle, EntityWrapper entityWrapper, ZoomData zoomData, EquipmentSlot slot) {
MCTiming scopeHandlerTiming = WeaponMechanics.timing("Scope Handler").startTiming();
boolean result = zoomOutWithoutTiming(weaponStack, weaponTitle, entityWrapper, zoomData, slot);
scopeHandlerTiming.stopTiming();

return result;
}
Expand Down Expand Up @@ -334,4 +329,4 @@ public void validate(Configuration configuration, SerializeData data) throws Ser
configuration.set(data.key + ".Shoot_Delay_After_Scope", shootDelayAfterScope * 50);
}
}
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package me.deecaad.weaponmechanics.weapon.shoot;

import co.aikar.timings.lib.MCTiming;
import me.deecaad.core.compatibility.CompatibilityAPI;
import me.deecaad.core.compatibility.worldguard.WorldGuardCompatibility;
import me.deecaad.core.file.*;
Expand Down Expand Up @@ -130,9 +129,7 @@ public boolean tryUse(EntityWrapper entityWrapper, String weaponTitle, ItemStack
Trigger trigger = getConfigurations().getObject(weaponTitle + ".Shoot.Trigger", Trigger.class);
if (trigger == null || !trigger.check(triggerType, slot, entityWrapper)) return false;

MCTiming shootHandlerTiming = WeaponMechanics.timing("Shoot Handler").startTiming();
boolean result = shootWithoutTrigger(entityWrapper, weaponTitle, weaponStack, slot, triggerType, dualWield);
shootHandlerTiming.stopTiming();

return result;
}
Expand Down Expand Up @@ -885,4 +882,4 @@ private boolean isInvalidFullAuto(TriggerType triggerType) {
default -> true;
};
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,6 @@ repositories {
url = uri("https://maven.enginehub.org/repo/")
}

maven {
url = uri("https://repo.aikar.co/content/groups/aikar/")
}

maven {
url = uri("https://mvn.lumine.io/repository/maven-public/")
}
Expand Down

0 comments on commit d9cd48c

Please sign in to comment.