Bug patch
This commit is contained in:
parent
9494c7dec1
commit
fecf07d9d3
78
build.gradle
78
build.gradle
|
@ -26,7 +26,7 @@ targetCompatibility = 1.8
|
||||||
|
|
||||||
version = "0.0.1"
|
version = "0.0.1"
|
||||||
group = "xamora.gp_dbc" // http://maven.apache.org/guides/mini/guide-naming-conventions.html
|
group = "xamora.gp_dbc" // http://maven.apache.org/guides/mini/guide-naming-conventions.html
|
||||||
archivesBaseName = "gp"
|
archivesBaseName = "gp_dbc"
|
||||||
|
|
||||||
minecraft {
|
minecraft {
|
||||||
version = "1.7.10-10.13.4.1614-1.7.10"
|
version = "1.7.10-10.13.4.1614-1.7.10"
|
||||||
|
@ -49,6 +49,40 @@ dependencies {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sourceSets {
|
||||||
|
main {
|
||||||
|
java {
|
||||||
|
srcDir 'src/main/java'
|
||||||
|
}
|
||||||
|
resources {
|
||||||
|
srcDir "src/main/resources"
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
/*server {
|
||||||
|
java {
|
||||||
|
srcDir 'src/server/java'
|
||||||
|
}
|
||||||
|
resources {
|
||||||
|
srcDir "src/server/resources"
|
||||||
|
}
|
||||||
|
|
||||||
|
runtimeClasspath = sourceSets.main.runtimeClasspath + sourceSets.main.output
|
||||||
|
compileClasspath = sourceSets.main.compileClasspath + sourceSets.main.output
|
||||||
|
}
|
||||||
|
client {
|
||||||
|
java {
|
||||||
|
srcDir 'src/client/java'
|
||||||
|
}
|
||||||
|
resources {
|
||||||
|
srcDir "src/client/resources"
|
||||||
|
}
|
||||||
|
|
||||||
|
runtimeClasspath = sourceSets.main.runtimeClasspath + sourceSets.main.output
|
||||||
|
compileClasspath = sourceSets.main.compileClasspath + sourceSets.main.output
|
||||||
|
}*/
|
||||||
|
}
|
||||||
|
|
||||||
processResources
|
processResources
|
||||||
{
|
{
|
||||||
// this will ensure that this task is redone when the versions change.
|
// this will ensure that this task is redone when the versions change.
|
||||||
|
@ -67,6 +101,32 @@ processResources
|
||||||
from(sourceSets.main.resources.srcDirs) {
|
from(sourceSets.main.resources.srcDirs) {
|
||||||
exclude 'mcmod.info'
|
exclude 'mcmod.info'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// replace stuff in mcmod.info, nothing else
|
||||||
|
/*from(sourceSets.server.resources.srcDirs) {
|
||||||
|
include 'mcmod.info'
|
||||||
|
|
||||||
|
// replace version and mcversion
|
||||||
|
expand 'version':project.version, 'mcversion':project.minecraft.version
|
||||||
|
}
|
||||||
|
|
||||||
|
// copy everything else, thats not the mcmod.info
|
||||||
|
from(sourceSets.server.resources.srcDirs) {
|
||||||
|
exclude 'mcmod.info'
|
||||||
|
}
|
||||||
|
|
||||||
|
// replace stuff in mcmod.info, nothing else
|
||||||
|
from(sourceSets.client.resources.srcDirs) {
|
||||||
|
include 'mcmod.info'
|
||||||
|
|
||||||
|
// replace version and mcversion
|
||||||
|
expand 'version':project.version, 'mcversion':project.minecraft.version
|
||||||
|
}
|
||||||
|
|
||||||
|
// copy everything else, thats not the mcmod.info
|
||||||
|
from(sourceSets.client.resources.srcDirs) {
|
||||||
|
exclude 'mcmod.info'
|
||||||
|
}*/
|
||||||
}
|
}
|
||||||
|
|
||||||
// Ensures that the encoding of source files is set to UTF-8, see http://yodaconditions.net/blog/fix-for-java-file-encoding-problems-with-gradle.html
|
// Ensures that the encoding of source files is set to UTF-8, see http://yodaconditions.net/blog/fix-for-java-file-encoding-problems-with-gradle.html
|
||||||
|
@ -78,12 +138,16 @@ tasks.withType(JavaCompile) {
|
||||||
task sourcesJar(type: Jar, dependsOn: classes) {
|
task sourcesJar(type: Jar, dependsOn: classes) {
|
||||||
classifier = "sources"
|
classifier = "sources"
|
||||||
from sourceSets.main.allSource
|
from sourceSets.main.allSource
|
||||||
|
//from sourceSets.server.allSource
|
||||||
|
//from sourceSets.client.allSource
|
||||||
}
|
}
|
||||||
|
|
||||||
// This task creates a .jar file containing a deobfuscated version of this mod, for other developers to use in a development environment.
|
// This task creates a .jar file containing a deobfuscated version of this mod, for other developers to use in a development environment.
|
||||||
task devJar(type: Jar) {
|
task devJar(type: Jar) {
|
||||||
classifier = "dev"
|
classifier = "dev"
|
||||||
from sourceSets.main.output
|
from sourceSets.main.output
|
||||||
|
//from sourceSets.server.output
|
||||||
|
//from sourceSets.client.output
|
||||||
}
|
}
|
||||||
|
|
||||||
// Creates the listed artifacts on building the mod.
|
// Creates the listed artifacts on building the mod.
|
||||||
|
@ -106,4 +170,16 @@ publishing.publications {
|
||||||
builtBy devJar
|
builtBy devJar
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Source set test separate client / server
|
||||||
|
task printSourceSetInformation(){
|
||||||
|
doLast{
|
||||||
|
sourceSets.each { srcSet ->
|
||||||
|
println "["+srcSet.name+"]"
|
||||||
|
print "-->Source directories: "+srcSet.allJava.srcDirs+"\n"
|
||||||
|
print "-->Output directories: "+srcSet.output.classesDirs.files+"\n"
|
||||||
|
println ""
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -12,20 +12,20 @@ import xamora.gp_dbc.system.GalacticPatrol;
|
||||||
import net.minecraft.creativetab.CreativeTabs;
|
import net.minecraft.creativetab.CreativeTabs;
|
||||||
import net.minecraft.item.Item;
|
import net.minecraft.item.Item;
|
||||||
|
|
||||||
@Mod(modid = Main.MODID, version = Main.VERSION, guiFactory = "gp_dbc.config.GuiFactoryConfig", canBeDeactivated = true)
|
@Mod(modid = Main.MODID, version = Main.VERSION, guiFactory = "xamora.gp_dbc.config.GuiFactoryConfig", canBeDeactivated = true)
|
||||||
public class Main
|
public class Main
|
||||||
{
|
{
|
||||||
|
|
||||||
@Mod.Instance(Main.MODID)
|
@Mod.Instance(Main.MODID)
|
||||||
public static Main main = new Main();
|
public static Main main = new Main();
|
||||||
|
|
||||||
@SidedProxy(clientSide = "gp_dbc.proxy.ClientProxy", serverSide = "gp_dbc.proxy.ServerProxy")
|
@SidedProxy(clientSide = "xamora.gp_dbc.proxy.ClientProxy", serverSide = "xamora.gp_dbc.proxy.ServerProxy")
|
||||||
public static CommonProxy proxy;
|
public static CommonProxy proxy;
|
||||||
|
|
||||||
public static GalacticPatrol gp = new GalacticPatrol();
|
public static GalacticPatrol gp = new GalacticPatrol();
|
||||||
|
|
||||||
public static final String MODID = "xamora/gp_dbc";
|
public static final String MODID = "gp_dbc";
|
||||||
public static final String VERSION = "0.0.0";
|
public static final String VERSION = "0.0.1";
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void preInit(FMLPreInitializationEvent e) {
|
public void preInit(FMLPreInitializationEvent e) {
|
||||||
|
|
|
@ -19,6 +19,7 @@ public class ServerProxy extends CommonProxy{
|
||||||
|
|
||||||
FMLCommonHandler.instance().bus().register(new TimeJail());
|
FMLCommonHandler.instance().bus().register(new TimeJail());
|
||||||
FMLCommonHandler.instance().bus().register(Main.gp);
|
FMLCommonHandler.instance().bus().register(Main.gp);
|
||||||
|
MinecraftForge.EVENT_BUS.register(Main.gp);
|
||||||
|
|
||||||
Handcuff handcuff = new Handcuff();
|
Handcuff handcuff = new Handcuff();
|
||||||
FMLCommonHandler.instance().bus().register(handcuff);
|
FMLCommonHandler.instance().bus().register(handcuff);
|
||||||
|
|
|
@ -152,27 +152,38 @@ public class GalacticPatrol {
|
||||||
return;
|
return;
|
||||||
|
|
||||||
EntityPlayer source = (EntityPlayer) event.source.getSourceOfDamage();
|
EntityPlayer source = (EntityPlayer) event.source.getSourceOfDamage();
|
||||||
if (!isInGalacticPatrol(source))
|
|
||||||
return;
|
|
||||||
|
|
||||||
EntityPlayer target = (EntityPlayer) event.entity;
|
EntityPlayer target = (EntityPlayer) event.entity;
|
||||||
if (isInGalacticPatrol(target))
|
|
||||||
|
if (isInGalacticPatrol(source) && isInGalacticPatrol(target))
|
||||||
|
return;
|
||||||
|
if (!isInGalacticPatrol(source) && !isInGalacticPatrol(target))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
InFightWithPatrollers.put(source.getUniqueID(), System.currentTimeMillis());
|
if (criminals.isCriminal(source.getUniqueID()))
|
||||||
|
InFightWithPatrollers.put(source.getUniqueID(), System.currentTimeMillis());
|
||||||
|
else if (criminals.isCriminal(target.getUniqueID()))
|
||||||
|
InFightWithPatrollers.put(target.getUniqueID(), System.currentTimeMillis());
|
||||||
}
|
}
|
||||||
|
|
||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
@SideOnly(Side.SERVER)
|
@SideOnly(Side.SERVER)
|
||||||
public void checkFightLogOut(PlayerEvent.PlayerLoggedOutEvent event) {
|
public void checkFightLogOut(PlayerEvent.PlayerLoggedOutEvent event) {
|
||||||
if (ConfigManager.CRIMINAL_QUIT_IN_FIGHT_GO_TO_JAIL)
|
if (!ConfigManager.CRIMINAL_QUIT_IN_FIGHT_GO_TO_JAIL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
long currentTime = System.currentTimeMillis();
|
||||||
Long time = InFightWithPatrollers.get(event.player.getUniqueID());
|
Long time = InFightWithPatrollers.get(event.player.getUniqueID());
|
||||||
if (time == null || System.currentTimeMillis() - time <= ConfigManager.CRIMINAL_TIME_TO_QUIT_IN_FIGHT)
|
if (time == null || currentTime - time > ConfigManager.CRIMINAL_TIME_TO_QUIT_IN_FIGHT)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
EntityPlayer jailer = null;
|
||||||
|
if (event.player.getLastAttacker() instanceof EntityPlayer) {
|
||||||
|
EntityPlayer attacker = (EntityPlayer) event.player.getLastAttacker();
|
||||||
|
if (isInGalacticPatrol(attacker))
|
||||||
|
jailer = attacker;
|
||||||
|
}
|
||||||
|
|
||||||
|
jail.putPlayerInJail(jailer, event.player);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,9 +6,12 @@ import cpw.mods.fml.common.gameevent.PlayerEvent;
|
||||||
import cpw.mods.fml.common.gameevent.TickEvent;
|
import cpw.mods.fml.common.gameevent.TickEvent;
|
||||||
import cpw.mods.fml.relauncher.Side;
|
import cpw.mods.fml.relauncher.Side;
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
|
import ibxm.Player;
|
||||||
|
import net.minecraft.entity.Entity;
|
||||||
import xamora.gp_dbc.Main;
|
import xamora.gp_dbc.Main;
|
||||||
import xamora.gp_dbc.network.client.NetworkHandcuffedC;
|
import xamora.gp_dbc.network.client.NetworkHandcuffedC;
|
||||||
import xamora.gp_dbc.proxy.CommonProxy;
|
import xamora.gp_dbc.proxy.CommonProxy;
|
||||||
|
import xamora.gp_dbc.utils.EntityUtils;
|
||||||
import xamora.gp_dbc.utils.InputUtils;
|
import xamora.gp_dbc.utils.InputUtils;
|
||||||
import xamora.gp_dbc.utils.PlayerUtils;
|
import xamora.gp_dbc.utils.PlayerUtils;
|
||||||
import xamora.gp_dbc.utils.TextUtils;
|
import xamora.gp_dbc.utils.TextUtils;
|
||||||
|
@ -74,7 +77,7 @@ public class Handcuff {
|
||||||
i--;
|
i--;
|
||||||
|
|
||||||
EntityPlayer patrol = getPlayerFromUUID(uuid_patrol);
|
EntityPlayer patrol = getPlayerFromUUID(uuid_patrol);
|
||||||
Main.gp.jail.putPlayerInJail(patrol, inmate, Main.gp.criminals.getCriminal(inmate.getUniqueID()));
|
Main.gp.jail.putPlayerInJail(patrol, inmate);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
hdfd.start_time = -1L;
|
hdfd.start_time = -1L;
|
||||||
|
@ -224,7 +227,7 @@ public class Handcuff {
|
||||||
|
|
||||||
@SideOnly(Side.SERVER)
|
@SideOnly(Side.SERVER)
|
||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
public void RemoveHandcuff(EntityInteractEvent event) {
|
public void TryToRemoveHandcuff(EntityInteractEvent event) {
|
||||||
if (event.target instanceof EntityPlayer) {
|
if (event.target instanceof EntityPlayer) {
|
||||||
EntityPlayer target = (EntityPlayer) event.target;
|
EntityPlayer target = (EntityPlayer) event.target;
|
||||||
EntityPlayer player = event.entityPlayer;
|
EntityPlayer player = event.entityPlayer;
|
||||||
|
@ -254,13 +257,17 @@ public class Handcuff {
|
||||||
Map.Entry<String, Long> entry = iterator.next();
|
Map.Entry<String, Long> entry = iterator.next();
|
||||||
String[] split = entry.getKey().split("~");
|
String[] split = entry.getKey().split("~");
|
||||||
UUID liberator_uuid = UUID.fromString(split[0]);
|
UUID liberator_uuid = UUID.fromString(split[0]);
|
||||||
|
UUID inmate_uuid = UUID.fromString(split[1]);
|
||||||
EntityPlayer liberator = PlayerUtils.getPlayerFromUUID(liberator_uuid);
|
EntityPlayer liberator = PlayerUtils.getPlayerFromUUID(liberator_uuid);
|
||||||
EntityPlayer inmate = PlayerUtils.getPlayerFromUUID(UUID.fromString(split[1]));
|
EntityPlayer inmate = PlayerUtils.getPlayerFromUUID(inmate_uuid);
|
||||||
if (liberator == null || inmate == null)
|
if (liberator == null || inmate == null)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
Entity target = EntityUtils.getEntityLookedAt(liberator, 5);
|
||||||
|
|
||||||
if ((InputUtils.useItemPressedPlayers.containsKey(liberator_uuid) && !InputUtils.useItemPressedPlayers.get(liberator_uuid))
|
if ((InputUtils.useItemPressedPlayers.containsKey(liberator_uuid) && !InputUtils.useItemPressedPlayers.get(liberator_uuid))
|
||||||
|| !liberator.isSneaking()) {
|
|| !liberator.isSneaking()
|
||||||
|
|| !(target instanceof EntityPlayer) || !target.getUniqueID().equals(inmate_uuid)) {
|
||||||
iterator.remove();
|
iterator.remove();
|
||||||
liberator.addChatMessage(new ChatComponentText(EnumChatFormatting.YELLOW + translateToLocal("msg.stop_unhandcuffing_someone")));
|
liberator.addChatMessage(new ChatComponentText(EnumChatFormatting.YELLOW + translateToLocal("msg.stop_unhandcuffing_someone")));
|
||||||
}
|
}
|
||||||
|
@ -293,6 +300,6 @@ public class Handcuff {
|
||||||
EntityPlayer inmate = event.player;
|
EntityPlayer inmate = event.player;
|
||||||
|
|
||||||
removeHandcuffed(inmate);
|
removeHandcuffed(inmate);
|
||||||
Main.gp.jail.putPlayerInJail(patrol, inmate, Main.gp.criminals.getCriminal(inmate.getUniqueID()));
|
Main.gp.jail.putPlayerInJail(patrol, inmate);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,6 +15,10 @@ public class Handcuffed {
|
||||||
|
|
||||||
public static long timeToWait = ConfigManager.TIME_TO_GO_IN_JAIL;
|
public static long timeToWait = ConfigManager.TIME_TO_GO_IN_JAIL;
|
||||||
|
|
||||||
|
public Handcuffed(UUID inmate, UUID jailer) {
|
||||||
|
this(inmate, jailer, System.currentTimeMillis(), false);
|
||||||
|
}
|
||||||
|
|
||||||
public Handcuffed(UUID inmate, long start_time) {
|
public Handcuffed(UUID inmate, long start_time) {
|
||||||
this(inmate, null, start_time, false);
|
this(inmate, null, start_time, false);
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,6 +14,7 @@ import net.minecraft.util.MathHelper;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
import static net.minecraft.util.StatCollector.translateToLocal;
|
import static net.minecraft.util.StatCollector.translateToLocal;
|
||||||
|
import static xamora.gp_dbc.Main.gp;
|
||||||
|
|
||||||
public class Jail {
|
public class Jail {
|
||||||
|
|
||||||
|
@ -102,17 +103,21 @@ public class Jail {
|
||||||
return cells;
|
return cells;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Cell putPlayerInJail(ICommandSender sender, EntityPlayer inmate, Criminal criminal) {
|
public Cell putPlayerInJail(ICommandSender sender, EntityPlayer inmate) {
|
||||||
|
Criminal criminal = gp.criminals.getCriminal(inmate.getUniqueID());
|
||||||
if (criminal == null)
|
if (criminal == null)
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
long sec = criminal.getTimeJail();
|
long sec = criminal.getTimeJail();
|
||||||
Main.gp.criminals.removeCriminal(criminal.getUuid());
|
gp.criminals.removeCriminal(criminal.getUuid());
|
||||||
return putPlayerInJail(sender, inmate, sec, sender != null);
|
return putPlayerInJail(sender, inmate, sec, sender != null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Cell putPlayerInJail(ICommandSender sender, EntityPlayer inmate, long sec, boolean chatMsg) {
|
public Cell putPlayerInJail(ICommandSender sender, EntityPlayer inmate, long sec, boolean chatMsg) {
|
||||||
|
|
||||||
|
if (inmate == null)
|
||||||
|
return null;
|
||||||
|
|
||||||
if (ConfigManager.pos_exit_jail == null) {
|
if (ConfigManager.pos_exit_jail == null) {
|
||||||
if (chatMsg)
|
if (chatMsg)
|
||||||
sender.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + translateToLocal("error.definition_exit_pos")));
|
sender.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + translateToLocal("error.definition_exit_pos")));
|
||||||
|
@ -139,7 +144,7 @@ public class Jail {
|
||||||
|
|
||||||
String timeString = displayTimeInJail(sec);
|
String timeString = displayTimeInJail(sec);
|
||||||
|
|
||||||
if (!translateToLocal("success.in_jail").isEmpty())
|
if (!translateToLocal("success.in_jail").isEmpty() && sender != null)
|
||||||
sender.addChatMessage(new ChatComponentText(EnumChatFormatting.GREEN + translateToLocal("success.in_jail") + timeString));
|
sender.addChatMessage(new ChatComponentText(EnumChatFormatting.GREEN + translateToLocal("success.in_jail") + timeString));
|
||||||
if (!translateToLocal("msg.inmate_going_to_jail").isEmpty())
|
if (!translateToLocal("msg.inmate_going_to_jail").isEmpty())
|
||||||
inmate.addChatMessage(new ChatComponentText(EnumChatFormatting.GREEN + translateToLocal("msg.inmate_going_to_jail") + timeString));
|
inmate.addChatMessage(new ChatComponentText(EnumChatFormatting.GREEN + translateToLocal("msg.inmate_going_to_jail") + timeString));
|
||||||
|
|
|
@ -21,14 +21,14 @@ public class InputUtils {
|
||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
public void handleMouseInput (InputEvent.MouseInputEvent event) {
|
public void handleMouseInput (InputEvent.MouseInputEvent event) {
|
||||||
GameSettings gameSettings = Minecraft.getMinecraft().gameSettings;
|
GameSettings gameSettings = Minecraft.getMinecraft().gameSettings;
|
||||||
boolean pressed = gameSettings.keyBindUseItem.isPressed();
|
boolean pressed = gameSettings.keyBindUseItem.getIsKeyPressed();
|
||||||
if (pressed == useItemPressed)
|
if (pressed == useItemPressed)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
useItemPressed = pressed;
|
useItemPressed = pressed;
|
||||||
CommonProxy.network.sendToServer(new NetworkKeyManage("useItem~" + useItemPressed));
|
CommonProxy.network.sendToServer(new NetworkKeyManage("useItem~" + useItemPressed));
|
||||||
|
|
||||||
//System.out.println(useItemPressed);
|
System.out.println(useItemPressed);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue