Advertisement
james1bow

Untitled

Feb 15th, 2024
1,101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.70 KB | None | 0 0
  1. if(evt.getKey() == Key.LeftArrow){
  2.                 if(player.hasAttribute("mateselect")){
  3.                     Npc[] npcs = (Npc[])player.getAttribute("npcs");
  4.                     int currentnpc = (Integer)player.getAttribute("currentnpc");
  5.                     currentnpc--;
  6.                     if(currentnpc==-1){
  7.                         currentnpc=npcs.length-1;
  8.                         Npc npc = (Npc)npcs[currentnpc];
  9.                         updateheartposition(player, npc);
  10.                         player.setAttribute("currentnpc", currentnpc);
  11.                         return;
  12.                     }if(currentnpc>=0){
  13.                         Npc npc = (Npc)npcs[currentnpc];
  14.                         updateheartposition(player, npc);
  15.                         player.setAttribute("currentnpc", currentnpc);
  16.                     }
  17.                 }
  18.             }if(evt.getKey() == Key.RightArrow){
  19.                 if(player.hasAttribute("mateselect")){
  20.                     Npc[] npcs = (Npc[])player.getAttribute("npcs");
  21.                     int currentnpc = (Integer)player.getAttribute("currentnpc");
  22.                     currentnpc++;
  23.                     if(currentnpc==npcs.length){
  24.                         currentnpc=0;
  25.                         Npc npc = (Npc)npcs[currentnpc];
  26.                         updateheartposition(player, npc);
  27.                         player.setAttribute("currentnpc", currentnpc);
  28.                     }if(currentnpc<=npcs.length-1){
  29.                         Npc npc = (Npc)npcs[currentnpc];
  30.                         updateheartposition(player, npc);
  31.                         player.setAttribute("currentnpc", currentnpc);  
  32.                     }
  33.                 }
  34.             }  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement