-
-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #12 from magneticflux-/develop
Cut new release
- Loading branch information
Showing
25 changed files
with
1,152 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
distributionBase=GRADLE_USER_HOME | ||
distributionPath=wrapper/dists | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-5.6-all.zip | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.2-all.zip | ||
zipStoreBase=GRADLE_USER_HOME | ||
zipStorePath=wrapper/dists |
34 changes: 34 additions & 0 deletions
34
src/main/java/com/skaggsm/mumblelinkmod/ServerOnChangeDimensionCallback.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
package com.skaggsm.mumblelinkmod; | ||
|
||
import net.fabricmc.fabric.api.event.Event; | ||
import net.fabricmc.fabric.api.event.EventFactory; | ||
import net.minecraft.server.network.ServerPlayerEntity; | ||
import net.minecraft.world.dimension.DimensionType; | ||
|
||
/** | ||
* Created by Mitchell Skaggs on 5/29/2019. | ||
*/ | ||
|
||
public interface ServerOnChangeDimensionCallback { | ||
Event<ServerOnChangeDimensionCallback> EVENT = EventFactory.createArrayBacked(ServerOnChangeDimensionCallback.class, (listeners) -> | ||
EventFactory.isProfilingEnabled() ? | ||
(toDimension, player) -> { | ||
player.server.getProfiler().push("fabricServerOnChangeDimension"); | ||
|
||
for (ServerOnChangeDimensionCallback event : listeners) { | ||
player.server.getProfiler().push(EventFactory.getHandlerName(event)); | ||
event.onChangeDimension(toDimension, player); | ||
player.server.getProfiler().pop(); | ||
} | ||
|
||
player.server.getProfiler().pop(); | ||
} : | ||
(toDimension, player) -> { | ||
for (ServerOnChangeDimensionCallback event : listeners) { | ||
event.onChangeDimension(toDimension, player); | ||
} | ||
|
||
}); | ||
|
||
void onChangeDimension(DimensionType toDimension, ServerPlayerEntity player); | ||
} |
33 changes: 33 additions & 0 deletions
33
src/main/java/com/skaggsm/mumblelinkmod/ServerOnConnectCallback.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
package com.skaggsm.mumblelinkmod; | ||
|
||
import net.fabricmc.fabric.api.event.Event; | ||
import net.fabricmc.fabric.api.event.EventFactory; | ||
import net.minecraft.server.network.ServerPlayerEntity; | ||
|
||
/** | ||
* Created by Mitchell Skaggs on 5/29/2019. | ||
*/ | ||
|
||
public interface ServerOnConnectCallback { | ||
Event<ServerOnConnectCallback> EVENT = EventFactory.createArrayBacked(ServerOnConnectCallback.class, (listeners) -> | ||
EventFactory.isProfilingEnabled() ? | ||
(player) -> { | ||
player.server.getProfiler().push("fabricServerOnConnect"); | ||
|
||
for (ServerOnConnectCallback event : listeners) { | ||
player.server.getProfiler().push(EventFactory.getHandlerName(event)); | ||
event.onConnect(player); | ||
player.server.getProfiler().pop(); | ||
} | ||
|
||
player.server.getProfiler().pop(); | ||
} : | ||
(player) -> { | ||
for (ServerOnConnectCallback event : listeners) { | ||
event.onConnect(player); | ||
} | ||
|
||
}); | ||
|
||
void onConnect(ServerPlayerEntity player); | ||
} |
34 changes: 34 additions & 0 deletions
34
src/main/java/com/skaggsm/mumblelinkmod/ServerOnTeamsModify.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
package com.skaggsm.mumblelinkmod; | ||
|
||
import net.fabricmc.fabric.api.event.Event; | ||
import net.fabricmc.fabric.api.event.EventFactory; | ||
import net.minecraft.scoreboard.ServerScoreboard; | ||
import net.minecraft.server.MinecraftServer; | ||
|
||
/** | ||
* Created by Mitchell Skaggs on 5/29/2019. | ||
*/ | ||
|
||
public interface ServerOnTeamsModify { | ||
Event<ServerOnTeamsModify> EVENT = EventFactory.createArrayBacked(ServerOnTeamsModify.class, (listeners) -> | ||
EventFactory.isProfilingEnabled() ? | ||
(scoreboard, server) -> { | ||
server.getProfiler().push("fabricServerOnScoreboardUpdate"); | ||
|
||
for (ServerOnTeamsModify event : listeners) { | ||
server.getProfiler().push(EventFactory.getHandlerName(event)); | ||
event.onScoreboardModify(scoreboard, server); | ||
server.getProfiler().pop(); | ||
} | ||
|
||
server.getProfiler().pop(); | ||
} : | ||
(scoreboard, server) -> { | ||
for (ServerOnTeamsModify event : listeners) { | ||
event.onScoreboardModify(scoreboard, server); | ||
} | ||
|
||
}); | ||
|
||
void onScoreboardModify(ServerScoreboard scoreboard, MinecraftServer server); | ||
} |
22 changes: 22 additions & 0 deletions
22
src/main/java/com/skaggsm/mumblelinkmod/mixin/MixinPlayerManager.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package com.skaggsm.mumblelinkmod.mixin; | ||
|
||
import com.skaggsm.mumblelinkmod.ServerOnConnectCallback; | ||
import net.minecraft.network.ClientConnection; | ||
import net.minecraft.server.PlayerManager; | ||
import net.minecraft.server.network.ServerPlayerEntity; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.injection.At; | ||
import org.spongepowered.asm.mixin.injection.Inject; | ||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; | ||
import org.spongepowered.asm.mixin.injection.callback.LocalCapture; | ||
|
||
/** | ||
* Created by Mitchell Skaggs on 5/29/2019. | ||
*/ | ||
@Mixin(PlayerManager.class) | ||
public class MixinPlayerManager { | ||
@Inject(method = "onPlayerConnect", at = @At("RETURN"), locals = LocalCapture.CAPTURE_FAILEXCEPTION) | ||
private void onPlayerConnect(ClientConnection clientConnection_1, ServerPlayerEntity serverPlayerEntity_1, CallbackInfo ci) { | ||
ServerOnConnectCallback.EVENT.invoker().onConnect(serverPlayerEntity_1); | ||
} | ||
} |
21 changes: 21 additions & 0 deletions
21
src/main/java/com/skaggsm/mumblelinkmod/mixin/MixinServerPlayerEntity.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package com.skaggsm.mumblelinkmod.mixin; | ||
|
||
import com.skaggsm.mumblelinkmod.ServerOnChangeDimensionCallback; | ||
import net.minecraft.entity.Entity; | ||
import net.minecraft.server.network.ServerPlayerEntity; | ||
import net.minecraft.world.dimension.DimensionType; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.injection.At; | ||
import org.spongepowered.asm.mixin.injection.Inject; | ||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; | ||
|
||
/** | ||
* Created by Mitchell Skaggs on 9/15/2019. | ||
*/ | ||
@Mixin(ServerPlayerEntity.class) | ||
public abstract class MixinServerPlayerEntity { | ||
@Inject(method = "changeDimension", at = @At(value = "RETURN")) | ||
private void onChangeDimension(DimensionType dimensionType_1, CallbackInfoReturnable<Entity> cir) { | ||
ServerOnChangeDimensionCallback.EVENT.invoker().onChangeDimension(dimensionType_1, (ServerPlayerEntity) (Object) this); | ||
} | ||
} |
43 changes: 43 additions & 0 deletions
43
src/main/java/com/skaggsm/mumblelinkmod/mixin/MixinServerScoreboard.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
package com.skaggsm.mumblelinkmod.mixin; | ||
|
||
import com.skaggsm.mumblelinkmod.ServerOnTeamsModify; | ||
import net.minecraft.scoreboard.ServerScoreboard; | ||
import net.minecraft.scoreboard.Team; | ||
import net.minecraft.server.MinecraftServer; | ||
import org.spongepowered.asm.mixin.Final; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.Shadow; | ||
import org.spongepowered.asm.mixin.injection.At; | ||
import org.spongepowered.asm.mixin.injection.Inject; | ||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; | ||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; | ||
|
||
/** | ||
* Created by Mitchell Skaggs on 5/29/2019. | ||
*/ | ||
@Mixin(ServerScoreboard.class) | ||
public class MixinServerScoreboard { | ||
@Shadow | ||
@Final | ||
private MinecraftServer server; | ||
|
||
@Inject(method = "addPlayerToTeam", at = @At(value = "RETURN", ordinal = 0)) | ||
private void onAddPlayerToTeam(String string_1, Team team_1, CallbackInfoReturnable<Boolean> cir) { | ||
doOnScoreboardModify(); | ||
} | ||
|
||
@Inject(method = "removePlayerFromTeam", at = @At("TAIL")) | ||
private void onRemovePlayerFromTeam(String string_1, Team team_1, CallbackInfo ci) { | ||
doOnScoreboardModify(); | ||
} | ||
|
||
@Inject(method = "updateRemovedTeam", at = @At("TAIL")) | ||
private void onUpdateRemovedTeam(Team team_1, CallbackInfo ci) { | ||
doOnScoreboardModify(); | ||
} | ||
|
||
private void doOnScoreboardModify() { | ||
ServerScoreboard scoreboard = (ServerScoreboard) (Object) this; | ||
ServerOnTeamsModify.EVENT.invoker().onScoreboardModify(scoreboard, this.server); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.