Skip to content

Commit

Permalink
Toiletman
Browse files Browse the repository at this point in the history
  • Loading branch information
not-coded committed Jan 7, 2024
1 parent 5d840e4 commit 3a3afed
Show file tree
Hide file tree
Showing 9 changed files with 309 additions and 103 deletions.
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
package com.nexia.core.mixin.block;

import com.nexia.ffa.FfaUtil;
import com.nexia.ffa.classic.utilities.FfaClassicUtil;
import com.nexia.ffa.kits.utilities.FfaKitsUtil;
import net.minecraft.core.BlockPos;
import net.minecraft.server.level.ServerPlayer;
import net.minecraft.world.InteractionHand;
import net.minecraft.world.InteractionResult;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.level.GameType;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.DispenserBlock;
import net.minecraft.world.level.block.state.BlockState;
Expand All @@ -25,6 +22,6 @@ public void onUse(BlockState blockState, Level level, BlockPos blockPos, Player
if(!(player instanceof ServerPlayer))
return;

if(FfaUtil.isFfaPlayer(player) && ((ServerPlayer) player).gameMode.getGameModeForPlayer() == GameType.ADVENTURE) { cir.setReturnValue(InteractionResult.FAIL); }
if(FfaUtil.isFfaPlayer(player) && !player.isCreative()) { cir.setReturnValue(InteractionResult.FAIL); }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ public static void everyTick() {

BwGame.tick();
SkyFfaBlocks.tick();
OitcGame.tick();

if (totalTickCount % 5 == 0) {
FfaClassicUtil.fiveTick();
Expand Down
4 changes: 4 additions & 0 deletions src/main/java/com/nexia/ffa/kits/FfaKit.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ public class FfaKit {
public static final FfaKit ARCHER = new FfaKit("archer", new ItemStack(Items.BOW));
public static final FfaKit MAGE = new FfaKit("mage", new ItemStack(Items.DRAGON_BREATH));

public static final FfaKit KIT6 = new FfaKit("kit_6", new ItemStack(Items.BARRIER));

public static final FfaKit KIT7 = new FfaKit("kit_7", new ItemStack(Items.BARRIER));

public FfaKit(String id, ItemStack item) {
this.id = id;
this.item = item;
Expand Down
347 changes: 262 additions & 85 deletions src/main/java/com/nexia/minigames/games/oitc/OitcGame.java

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ public class OitcGameMode {
public OitcGameMode(String id) {
this.id = id;
}
}
}
37 changes: 32 additions & 5 deletions src/main/java/com/nexia/minigames/games/oitc/OitcMap.java
Original file line number Diff line number Diff line change
@@ -1,17 +1,39 @@
package com.nexia.minigames.games.oitc;

import com.nexia.core.utilities.pos.EntityPos;
import net.minecraft.core.BlockPos;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

public class OitcMap {

public static List<OitcMap> oitcMaps = new ArrayList<>();

public static List<String> stringOitcMaps = new ArrayList<>();

public String id;

public static OitcMap CITY = new OitcMap("city");
public String name;

public BlockPos corner1;

public BlockPos corner2;

public int maxPlayers;
public ArrayList<EntityPos> spawnPositions;

public static OitcMap CITY = new OitcMap("city", "City", 8, new BlockPos(0, 0, 0), new BlockPos(0, 0, 0),
new ArrayList<>(Arrays.asList(
new EntityPos(0, 80, 0,0,0),
new EntityPos(0, 80, 0,0,0),
new EntityPos(0, 80, 0,0,0),
new EntityPos(0, 80, 0,0,0),
new EntityPos(0, 80, 0,0,0),
new EntityPos(0, 80, 0,0,0),
new EntityPos(0, 80, 0,0,0),
new EntityPos(0, 80, 0,0,0)
))
);


public static OitcMap identifyMap(String name) {
Expand All @@ -21,10 +43,15 @@ public static OitcMap identifyMap(String name) {
return null;
}

public OitcMap(String id) {
public OitcMap(String id, String name, int maxPlayers, BlockPos corner1, BlockPos corner2, ArrayList<EntityPos> spawnPositions) {
this.id = id;
this.name = name;
this.maxPlayers = maxPlayers;
this.spawnPositions = spawnPositions;

this.corner1 = corner1;
this.corner2 = corner2;

OitcMap.stringOitcMaps.add(id);
OitcMap.oitcMaps.add(this);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import com.nexia.core.utilities.chat.LegacyChatFormat;
import com.nexia.core.utilities.time.ServerTime;
import com.nexia.core.utilities.time.TickUtil;
import com.nexia.minigames.games.oitc.OitcGame;
import com.nexia.minigames.games.oitc.util.player.PlayerDataManager;
import net.minecraft.network.chat.TextComponent;
Expand All @@ -15,6 +14,7 @@
import net.minecraft.world.scores.Score;
import net.minecraft.world.scores.Scoreboard;
import net.minecraft.world.scores.criteria.ObjectiveCriteria;
import net.notcoded.codelib.util.TickUtil;

import java.util.ArrayList;

Expand All @@ -31,7 +31,7 @@ public class OitcScoreboard {
title, ObjectiveCriteria.RenderType.INTEGER);

public static void setUpScoreboard() {
for (ServerPlayer player : OitcGame.alive) {
for (ServerPlayer player : OitcGame.getViewers()) {
sendOITCScoreboard(player);
}
updateScoreboard();
Expand All @@ -53,7 +53,7 @@ public static void updateScoreboard() {
addLines(lines);
updateTimer();

for (ServerPlayer player : OitcGame.alive) {
for (ServerPlayer player : OitcGame.getViewers()) {
updateStats(player);
sendLines(player);
}
Expand Down Expand Up @@ -134,4 +134,4 @@ public static void removeScoreboardFor(ServerPlayer player) {
player.connection.send(new ClientboundSetDisplayObjectivePacket(1, null));
}

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@ public class PlayerData {

public int kills;

public int deathTime;
public boolean hasDied;

public PlayerData(SavedPlayerData savedData) {
this.savedData = savedData;

this.gameMode = OitcGameMode.LOBBY;
this.kills = 0;
this.deathTime = 5;
this.hasDied = false;
}

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -424,7 +424,7 @@ public static void death(ServerPlayer victim, DamageSource source){
victim.destroyVanishingCursedItems();
victim.inventory.dropAll();

victimData.savedData.losses++;
if(SkywarsGame.winner != accurateVictim) victimData.savedData.losses++;
SkywarsGame.alive.remove(accurateVictim);
SkywarsGame.spectator.add(accurateVictim);
PlayerDataManager.get(victim).gameMode = SkywarsGameMode.SPECTATOR;
Expand Down

0 comments on commit 3a3afed

Please sign in to comment.