-
-
Save wesserboy/e52ba8561b5a03738dec to your computer and use it in GitHub Desktop.
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
package chunkedPVP.commands; | |
import net.minecraft.command.CommandBase; | |
import net.minecraft.command.ICommandSender; | |
import net.minecraft.util.ChatComponentTranslation; | |
import net.minecraft.util.ChunkCoordinates; | |
import net.minecraft.world.chunk.Chunk; | |
import chunkedPVP.worldData.ChunkedPVPWorldData; | |
public class PVPReadCommand extends CommandBase{ | |
@Override | |
public String getCommandName() { | |
return "getPVP"; | |
} | |
@Override | |
public String getCommandUsage(ICommandSender var1) { | |
return "Shows a chat massage that tells wether pvp is enabled in the chunk the player is currently located in."; | |
} | |
@Override | |
public void processCommand(ICommandSender sender, String[] var2) { | |
ChunkedPVPWorldData data = ChunkedPVPWorldData.forWorld(sender.getEntityWorld()); | |
ChunkCoordinates coords = sender.getPlayerCoordinates(); | |
Chunk chunk = sender.getEntityWorld().getChunkFromBlockCoords(coords.posX, coords.posZ); | |
if(data.compound != null){ | |
data.readFromNBT(data.compound); | |
} | |
sender.addChatMessage(new ChatComponentTranslation("PVP Mode: " + data.hasChunk(chunk))); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment