use of org.neo4j.ogm.domain.gh824.User in project Village_Defense by Plajer.
the class MedicKit method onZombieHit.
@EventHandler
public void onZombieHit(EntityDamageByEntityEvent event) {
if (event.getDamager().getType() != EntityType.PLAYER)
return;
if (event.getEntity().getType() != EntityType.ZOMBIE)
return;
User user = UserManager.getUser(event.getDamager().getUniqueId());
if (!(user.getKit() instanceof MedicKit))
return;
if (Math.random() <= 0.1) {
for (Entity entity : user.toPlayer().getNearbyEntities(5, 5, 5)) {
if (entity.getType() == EntityType.PLAYER) {
Player player = (Player) entity;
if (player.getMaxHealth() > (player.getHealth() + 1)) {
player.setHealth(player.getHealth() + 1);
} else {
player.setHealth(player.getMaxHealth());
}
player.getEyeLocation().getWorld().playEffect(player.getEyeLocation(), Effect.HEART, 20);
}
}
}
}
use of org.neo4j.ogm.domain.gh824.User in project kripton by xcesco.
the class Test209Model2Runtime method testRunSqlite1.
/**
* Test run sqlite 1.
*/
@Test
public void testRunSqlite1() {
BindApp2DataSource ds = BindApp2DataSource.getInstance();
ds.execute(new Transaction() {
@Override
public TransactionResult onExecute(BindApp2DaoFactory daoFactory) {
Device device = new Device();
device.name = "device-test";
daoFactory.getDeviceDao().insert(device);
User user = new User();
user.userName = "user-test";
daoFactory.getUserDao().insert(user);
UserDevice userDevice = new UserDevice(0, user.id, device.id);
daoFactory.getUserDeviceDao().insert(userDevice);
List<Device> devices = daoFactory.getDeviceDao().getUserDevices(user.id);
Assert.assertTrue(devices.size() == 1);
return TransactionResult.ROLLBACK;
}
});
}
use of org.neo4j.ogm.domain.gh824.User in project actframework by actframework.
the class GHIssue353 method testPut.
@Test
public void testPut() throws Exception {
url("/gh/353").accept(H.Format.JSON).postJSON(user);
String s = resp().body().string();
User user2 = JSON.parseObject(s, User.class);
assertNotNull(user2._id());
checkRespCode();
reset();
Map<String, String> updates = C.Map("name", "Donald Mickey");
url("/gh/353/" + user2.getIdAsStr()).accept(H.Format.JSON).postJSON(updates).put();
s = resp().body().string();
User user3 = JSON.parseObject(s, User.class);
eq(user2.getId(), user3.getId());
eq("Donald Mickey", user3.name);
}
use of org.neo4j.ogm.domain.gh824.User in project camel-quarkus by apache.
the class OpenstackKeystoneUserResource method updateShouldSucceed.
@Path("/updateShouldSucceed")
@POST
public void updateShouldSucceed() {
LOG.debug("Calling OpenstackKeystoneUserResource.updateShouldSucceed()");
User in = Builders.user().id(USER_ID).email(USER_EMAIL_UPDATED).build();
String uri = String.format(URI_FORMAT, OpenstackConstants.UPDATE);
User out = template.requestBody(uri, in, User.class);
assertNotNull(out);
assertEquals(USER_ID, out.getId());
assertEquals(USER_EMAIL_UPDATED, out.getEmail());
}
use of org.neo4j.ogm.domain.gh824.User in project camel-quarkus by apache.
the class OpenstackKeystoneUserResource method getShouldSucceed.
@Path("/getShouldSucceed")
@POST
public void getShouldSucceed() {
LOG.debug("Calling OpenstackKeystoneUserResource.getShouldSucceed()");
String uri = String.format(URI_FORMAT, OpenstackConstants.GET);
User out = template.requestBodyAndHeader(uri, null, OpenstackConstants.ID, USER_ID, User.class);
assertNotNull(out);
assertEquals(USER_NAME, out.getName());
assertEquals(USER_DOMAIN_ID, out.getDomainId());
assertTrue(out.isEnabled());
assertEquals(USER_ID, out.getId());
}
Aggregations